gpt4 book ai didi

highcharts - 在 Highcharts 的工具提示中获取轴名称

转载 作者:行者123 更新时间:2023-12-03 13:13:02 25 4
gpt4 key购买 nike

我在 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'
}
}
}

在我的 y 轴上我有:

yAxis:{
categories: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday","Sunday"]
}

显示为:

11:00 on 0 => total of 32 tickets

但我希望它在标签中显示实际日期:

11:00 on Monday => total of 32 tickets

我看过格式化程序,但我似乎无法访问 z 轴,因为它给出了一个未定义的。

如何在工具提示中使用 y 轴名称?

http://jsfiddle.net/qvw5gurc/1/

最佳答案

正如@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';
}
},

已更新 fiddle .

关于highcharts - 在 Highcharts 的工具提示中获取轴名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25350002/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com