gpt4 book ai didi

javascript - Highcharts : different units per Y axis

转载 作者:行者123 更新时间:2023-11-28 20:39:22 25 4
gpt4 key购买 nike

如何为我的个人 Y 轴添加单位?
我有 4 个轴,均具有不同的单位(C、hPa、%)

我的工具提示目前是这样的:

tooltip: {
formatter: function() {
return ''+
Highcharts.dateFormat('%H:%M',this.x) +': '+ this.y;
}
}

最佳答案

您可以根据系列更改工具提示。

示例

tooltip: {
formatter: function() {
if(this.series.name === 'Temperature') {
return ''+ Highcharts.dateFormat('%H:%M',this.x) +': '+ this.y + 'C';
} else {
return ''+ Highcharts.dateFormat('%H:%M',this.x) +': '+ this.y + '%';
}
}
}

Demo

关于javascript - Highcharts : different units per Y axis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14708307/

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