我在向工具提示添加一些信息时遇到了一些问题。
基本上,我的 Highcharts 是动态生成的,一切都运行良好,但我希望在工具提示中显示一个附加字段,但我无法使其工作。
如有任何帮助,我们将不胜感激。
这是我正在使用的代码片段,它生成“未定义”标签:
tooltip: {
formatter: function () {
var s;
if (this.point.name) {
s = '' + this.point.name + ': ' + this.y + ' fruits';
} else {
s = '' + this.series.title + ': ' + this.y + ' ' + this.x;
}
return s;
}
},
这是 jsfiddle:http://jsfiddle.net/9zN2M/2/
最佳答案
看起来 this.series
没有 title
属性。
不过,它确实有一个 name
属性,因此您应该能够使用 this.series.name
。
关于javascript - 将工具提示添加到 highcharts javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21517957/