在 this fiddle ,使用共享工具提示。就像魅力一样。
tooltip: {
formatter: function () {
console.log(this);
var s = '<b>' + this.x + '</b>';
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.y + 'm';
});
return s;
},
shared: true
}
现在我正在寻找一种方法来显示气泡图的共享工具提示,就像这样: http://jsfiddle.net/gn6dtx6x/1/
不幸的是,formatter
选项属性中的 this
对象与第一个示例不同。
那么,有没有办法在气泡图中共享工具提示,还是我必须创建自己的自定义工具提示功能?
感谢您的回答。
最佳答案
您需要迭代每个系列和点,比较 x 值。
tooltip: {
formatter: function () {
var s = '<b>' + this.x + '</b>',
x = this.point.x;
$.each(this.series.chart.series, function (i, serie) {
$.each(serie.data, function (j, p) {
if (p.x === x) {
s += '<br/>' + this.series.name + ': ' + p.y;
}
});
});
return s;
},
shared: true
},
关于javascript - Highcharts - 分类气泡图的共享工具提示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27334728/