我在一个图表中生成10个多个系列,默认情况下,两个系列保持可见,其他系列隐藏,其他则分别在按钮上显示。但问题是"悬停数据仅从最后渲染的系列中获取",我想从我悬停的系列中获取数据。
获取数据的代码是:
var $reporting = $('#hist_riskvalue'); /*HTML Div where data will be displayed*/
var $reporting2 = $('#hist_gindex'); /*HTML Div where data will be displayed*/
plotOptions: {
series: {
compare: 'percent',
point: {
events: {
mouseOver: function () {
var series = this.series.chart.series,
x = this.x,
y = this.y,
output = Highcharts.numberFormat(Math.abs(y));
//loop each series
$.each(series, function (i, e) {
if(i>0) {
$.each(series[i].data,function(j,point){
if(point.x === x) {
output += Highcharts.numberFormat(Math.abs(y));
}
});
}
});
var points = $('#histper-chart').highcharts().series[0].points;
for (var i = 0; i < points.length; i++) {
if (points[i].y === y){
yy = points[i].y;
output2 = Highcharts.numberFormat(Math.abs(yy));
break;
}
}
$reporting.html(output);
$reporting2.html(output2);
}
}
}
}
},
答案 0 :(得分:0)
使用&#34;共享:false&#34;在工具提示中:{}