2013-09-25 60 views
0

我開發了一個高圖表,但存在工具提示位置問題。 看來它不能正常刷新。當我使用鼠標時,它會卡住,或者顯示我放置鼠標的早期點的工具提示。我不確定我是否做錯了什麼。高圖表工具提示位置問題

Here is a fiddle for you to playaround. 
http://jsfiddle.net/Mn6sB/ 

$(function() { 
     $('#container').highcharts({ 
      chart: { 
       renderTo: 'chartContainer', 
       type: 'spline' 
      }, 
      title: { 
       text: 'Pass rate statistics' 
      }, 
      subtitle: { 
       text: 'Pass count per xxx' 
      }, 
      xAxis: { 
       type: 'datetime', 
       minTickInterval: 24 * 3600 * 1000, 
       dateTimeLabelFormats: { // don't display the dummy year 
        month: '%e. %b', 
        year: '%b' 
       } 
      }, 
      yAxis: { 
       title: { 
        text: 'PassCount' 
       }, 
       min: 0 
      }, 
      tooltip: { 
       formatter: function() { 
         return '<b>'+ this.series.name +'</b><br/> Pass Count: '+ this.y; 
       } 
      }, 

      series: [{name: 'dev', data:[[Date.UTC(2013,9,25),12],[Date.UTC(2013,9,24),41],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,19),10],[Date.UTC(2013,9,18),22],[Date.UTC(2013,9,17),12],[Date.UTC(2013,9,16),16],[Date.UTC(2013,9,15),11],[Date.UTC(2013,9,14),4],[Date.UTC(2013,9,13),25],[Date.UTC(2013,9,12),11],[Date.UTC(2013,9,11),20],[Date.UTC(2013,9,10),16],[Date.UTC(2013,9,9),7],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,5),1],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,3),22],[Date.UTC(2013,9,2),13],[Date.UTC(2013,8,31),7],[Date.UTC(2013,8,30),12],[Date.UTC(2013,8,29),12],[Date.UTC(2013,8,28),5],[Date.UTC(2013,8,27),23],[Date.UTC(2013,8,26),2],]},{name: 'test', data:[[Date.UTC(2013,9,25),24],[Date.UTC(2013,9,24),4],[Date.UTC(2013,9,21),16],[Date.UTC(2013,9,20),41],[Date.UTC(2013,9,19),42],[Date.UTC(2013,9,18),42],[Date.UTC(2013,9,17),4],[Date.UTC(2013,9,16),3],[Date.UTC(2013,9,15),3],[Date.UTC(2013,9,14),3],[Date.UTC(2013,9,13),3],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,11),3],[Date.UTC(2013,9,9),3],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,6),10],[Date.UTC(2013,9,1),3],[Date.UTC(2013,8,30),1],[Date.UTC(2013,8,29),1],[Date.UTC(2013,8,28),10],]},{name: 'intermediate', data:[[Date.UTC(2013,9,25),1],[Date.UTC(2013,9,24),1],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,21),2],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,19),1],[Date.UTC(2013,9,18),1],[Date.UTC(2013,9,17),1],[Date.UTC(2013,9,16),1],[Date.UTC(2013,9,15),1],[Date.UTC(2013,9,13),1],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,11),1],[Date.UTC(2013,9,10),1],[Date.UTC(2013,9,9),1],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,3),1],[Date.UTC(2013,9,2),1],[Date.UTC(2013,9,1),1],[Date.UTC(2013,8,30),1],[Date.UTC(2013,8,29),2],[Date.UTC(2013,8,28),2],[Date.UTC(2013,8,27),2],]},{name: 'main', data:[[Date.UTC(2013,9,25),1],[Date.UTC(2013,9,24),1],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,21),1],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,19),1],[Date.UTC(2013,9,18),1],[Date.UTC(2013,9,17),1],[Date.UTC(2013,9,16),1],[Date.UTC(2013,9,14),1],[Date.UTC(2013,9,13),1],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,11),1],[Date.UTC(2013,9,10),1],[Date.UTC(2013,9,9),1],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,6),1],[Date.UTC(2013,9,5),1],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,3),1],[Date.UTC(2013,9,2),1],[Date.UTC(2013,9,1),1],[Date.UTC(2013,8,31),1],[Date.UTC(2013,8,30),1],[Date.UTC(2013,8,29),1],[Date.UTC(2013,8,28),2],[Date.UTC(2013,8,27),2],]},{name: 'test_th', data:[[Date.UTC(2013,9,24),4],[Date.UTC(2013,9,1),3],]},{name: 'intermediate_dev', data:[[Date.UTC(2013,9,21),1],[Date.UTC(2013,9,13),1],]},{name: 'rel', data:[[Date.UTC(2013,9,15),1],]},{name: 'staging', data:[[Date.UTC(2013,9,6),1],[Date.UTC(2013,8,30),1],]},{name: 'fun', data:[[Date.UTC(2013,9,5),1],[Date.UTC(2013,8,28),2],]},] 
     }); 
    }); 
+1

通過x的數據順序不正確。 –

回答

1

我認爲你需要做的就是按升序的x值順序對數據進行排序。這應該整理出來。

+0

嗨, 感謝,似乎爲我工作。但我剛剛意識到另一個你可能會提供幫助的問題。我的圖表日期倒退。意味着從今天開始倒退。但在圖表中,傳說正在向前發展,這很奇怪。我在Datew.UTC方法中將月份作爲9傳遞,但仍將月份顯示爲OCT。 –

+0

嗨。如果我的回答是正確的,請接受並加註,以便其他人可以告訴。 JavaScript中的月份從0開始,所以9月份是10月份。 – SteveP