我正在为我的条形图分配额外的隐藏参数。
"R1",5.01,“印度”,"maharashtra";
如何在高亮显示工具提示中显示这些隐藏的数据?
这是我用来显示工具提示的代码,但是我不能显示隐藏的数据。
highlighter: {
tooltipContentEditor: function (ev, seriesIndex, pointIndex, data) {
return data[3] ;
},
show: true
}谢谢
发布于 2016-01-07 10:27:01
tooltipContentEditor函数中的最后一个参数是一个绘图对象,而不是数据对象。不过,您可以从它获得数据对象。使用这个修改后的tooltipContentEditor函数,您应该能够获得工具提示来显示隐藏的数据:
highlighter: {
...
tooltipContentEditor: function(ev, seriesIndex, pointIndex, plot) {
// access the data and locate the correct data point based on the series and data point hovered over and return the hidden value from the data at array index 2 (array indexes are 0 based)
return plot.data[seriesIndex][pointIndex][2];
}
}在本例中,数据如下(第三个值是“隐藏”工具提示):
[
['23-May-08', 578.55, 'A'],
['20-Jun-08', 566.5, 'B'],
['25-Jul-08', 480.88, 'C'],
['22-Aug-08', 509.84, 'D'],
['26-Sep-08', 454.13, 'E'],
['24-Oct-08', 379.75, 'F']
]我创建了一个小提琴来演示这一点。
https://stackoverflow.com/questions/34629182
复制相似问题