使用工具提示格式化,我们可以显示系列名称和值,但是当使用plotoptions事件鼠标悬停完成相同时,我无法获得系列名称和值
工具提示:formatter
PlotOption:Mousover
mouseOver: function () {
$.each(this, function (i, e) {
$reporting.html('x: ' + this.x + 'Category: ' + this.series.name + ', y: ' +Highcharts.numberFormat(Math.abs(this.y)));
});
}
答案 0 :(得分:2)
在mouseover
mouseOver: function () {
console.log(this);
var series = this.series.chart.series,
x = this.x,
y = this.y,
output = 'x: ' + x + 'y: ' + Highcharts.numberFormat(Math.abs(y));
//loop each serie
$.each(series, function (i, e) {
output += ' Category: ' + this.name;
if(i>0) {
$.each(series[i].data,function(j,point){
if(point.x === x) {
output += ' y: ' + Highcharts.numberFormat(Math.abs(y));
}
});
}
});
$reporting.html(output);
}
}
},