2017-06-15 14 views
0

我已經將第四項添加到json heatmap數據中,該數據不會破壞熱圖,但是如何解決下面的工具提示格式化程序中新的第4項?如何將增強的工具提示內容添加到熱圖

原始隱式[X,Y,Z] 3項陣列 { 「名稱」: 「z軸」, 「數據」:[[0,488,3],[0,488,3],...

新增強的[x,y,z,comment] 4項數組 {「name」:「zaxis」,「data」:[[0,488,3,「 - 90.8 | -87.5 | 0.0 | 0.0」],[0,488, 3, 「 - 103.4 | -99.4 | 0.0 | 0.0」],...

formatter: function() { 
return '<b>' + this.series.yAxis.categories[this.point.y]+ '</b>' + 
'<br><b>' + this.point.value + '</b> dB' + 
' at <b>' + this.series.xAxis.categories[this.point.x] + '</b>'; 
}, 

有沒有更好的方式來做到這一點?

回答

0

簡單的答案發布在highcharts支持板上> 我應該更仔細一點。

+0

http://jsfiddle.net/ysyse7w5/ – TigerWoods

0

另一個選擇可能是使用keys,所以你可以有一個較小的JSON數據發送。

演示:http://jsfiddle.net/ysyse7w5/1/

series: [{ 
    name: 'Sales per employee', 
    borderWidth: 1, 
    data: [ 
     [0, 0, 10, 'custom text 1'], 
     [0, 1, 100, 'custom text 2'], 
     [1, 0, 100, 'custom text 3'], 
     [1, 1, 10, 'custom text 4'] 
    ], 
    keys: ['x', 'y', 'value', 'text'], 
    dataLabels: { 
     enabled: true, 
     formatter() { 
     return this.y + '<br>' + this.point.text 
     } 
    } 
    }] 
相關問題