我在Highcharts的甜甜圈里乱糟糟的馅饼,我似乎无法获得传奇或共享的工具提示。它工作得很好with non-shared tooltips:
tooltip: {
formatter: function () {
return this.point.name + ': ' +this.y
+ ' units (' + Highcharts.numberFormat(this.percentage, 0) + '%)'
;
},
},
但如果我尝试将其转换为shared tooltip,则不会出现任何内容。
tooltip: {
formatter: function () {
var s = this.series.name + this.point.name;
$.each(this.points, function (i, point) {
s += point.name + ' ' + point.y + ' ' + point.percentage;
});
return s;
},
shared: true
},
我无法弄清楚我做错了什么。
答案 0 :(得分:1)
只是看看格式化程序函数中的highcharts
(this
)对象。不确定您要完成的任务,但看起来highcharts
对象包含series
数组points
:
$.each(this.series.points, function (i, point) {
s += point.name + ' ' + point.y + ' ' + point.percentage + '<br/>';
});
编辑:为良好指标添加换行符= D