2013-04-14 78 views
3

獲取工具提示的問題。 您只會看到第一個點和最後一個點的工具提示。Highcharts&tooltip error

如何幫助輸出工具提示圖表上的所有點?

http://jsfiddle.net/RBfwG/1/

var options = { 
    chart: { 
     type: 'line', 
     renderTo: 'container', 
     zoomType: 'x' 
    }, 

    xAxis: { 
     type: 'datetime' 
    }, 

    tooltip: { 
     shared: true, 
     crosshairs: true, 
     xDateFormat: '<b>%H:%M</b>' 
    }, 
    "series": [{ 
     "name": "T", 
     "data": [[1365895320000, 26], [1365895020000, 26.0625], [1365894720000, 26.0625], [1365894420000, 26.0625], [1365894120000, 26.125], [1365893820000, 26.125], [1365893520000, 26.1875], [1365893220000, 26.1875], [1365892920000, 26.25], [1365892620000, 26.25], [1365892320000, 26.3125], [1365892020000, 26.3125], [1365891720000, 26.3125], [1365891420000, 26.375], [1365891120000, 26.375], [1365890820000, 26.375], [1365890520000, 26.4375], [1365890220000, 26.5], [1365889920000, 26.5625], [1365889620000, 26.5625], [1365889320000, 26.625], [1365889020000, 26.6875], [1365888720000, 26.6875], [1365888420000, 26.75], [1365888120000, 26.8125], [1365887820000, 26.875], [1365887520000, 26.9375], [1365887220000, 27.0625], [1365886920000, 27.125], [1365886620000, 27.1875], [1365886320000, 27.25], [1365886020000, 27.1875], [1365885720000, 27.25], [1365885420000, 27.25], [1365885120000, 27.25], [1365884820000, 27.25], [1365884520000, 27.25], [1365884220000, 27.3125], [1365883920000, 27.3125], [1365883620000, 27.3125] ] 
    }] 
}; 
var chart = new Highcharts.Chart(options); 
+0

嗯,這很有趣。我從來沒有使用過HighCharts,但是從他們的Docs看來,這看起來應該起作用。我認爲將這個類型作爲'datetime'使用是個問題,因爲這可以工作:http://jsfiddle.net/RBfwG/2/ – Ian

回答

2

Highcharts期望的數據在X值來預先排序升序。

someData = [ 
     [1365895320000, 26], 
     [1365895020000, 26.0625], 
     [1365894720000, 26.0625], 
     [1365894420000, 26.0625], 
     [1365894120000, 26.125], 
     [1365893820000, 26.125]    
    ]; 

    someData.sort(); 

查看固定小提琴here