javascript - 将工具提示添加到 highcharts javascript

标签 javascript highcharts tooltip

我在向工具提示添加一些信息时遇到了一些问题。

基本上,我的 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/

相关文章:

css - 将工具提示添加到子菜单

javascript - ES6 类 : is it possible to access the constructor of a child class from the parent?

javascript - Highcharts 漏斗图构造函数

javascript - FullCalendar 在尝试添加工具提示时返回 "Failure Parsing JSON"

python - 如何将条形图添加到基于 Django 的数据库?

javascript - HighStocks - 在同一页面上添加 2 个图表

javascript - Joomla 中包含 HTML 的工具提示

javascript - 气泡图 : how to avoid bubbles being cut off? 谷歌可视化

javascript - 在主页 JavaScript 中只显示一个 div

Javascript - 网页内容转字符串