我在Highcharts中使用气泡图,我正在尝试更改悬停工具提示以显示更有意义的输出 - 目前我可以让它显示轴值但我无法显示标签.
我在我的plotoptions中使用它:
plotOptions: {
bubble: {
minSize: 1,
maxSize: 40,
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x}:00 UTC on {point.y} => total of {point.z} tickets'
}
}
}
Run Code Online (Sandbox Code Playgroud)
在我的轴上,我有:
yAxis:{
categories: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday"]
}
Run Code Online (Sandbox Code Playgroud)
显示为:
11:00 on 0 => total of 32 tickets
Run Code Online (Sandbox Code Playgroud)
但我想在标签中显示实际的一天:
11:00 on Monday => total of 32 tickets
Run Code Online (Sandbox Code Playgroud)
我看过格式化程序,但后来我似乎无法访问z轴,因为它给出了一个未定义的.
如何在工具提示中使用y轴名称?
正如@Ondkloss在评论中所说,使用tooltip.formatter代替:
tooltip: {
formatter: function () {
return '<b>' + this.series.name + '</b><br>' + this.point.x + ':00 UTC on ' + this.series.yAxis.categories[this.point.y] + '=> total on ' + this.point.z + 'tickets';
}
},
Run Code Online (Sandbox Code Playgroud)
更新了小提琴.