图像本身会说话,我想在y轴上以小时为单位显示持续时间。但每次值达到24h时,y轴都会重置为0。图像中蓝条的实际值为28:19:15,但由于已重置,因此仅显示4小时(y轴的第4个值显示0)
我当前配置:
{
"chart": {
"type": "column"
},
"plotOptions": {
"column": {
"dataLabels": {
"enabled": true
}
}
},
"series": [
{
"data": [
101955467,
0,
0
],
"dataLabels": {
"enabled": true,
"format": "{y:%H:%M:%S}"
},
"name": "duration",
"stack": null,
"yAxis": "1"
}
],
"xAxis": [
{
"categories": [
"cat 1",
"cat 2",
"cat 3"
]
}
],
"yAxis": [
{
"allow_decimals": false,
"dateTimeLabelFormats": {
"day": "%H:%M",
"hour": "%H:%M",
"minute": "%H:%M",
"month": "%H:%M",
"second": "%H:%M",
"week": "%H:%M",
"year": "%H:%M"
},
"id": "1",
"labels": {
"format": "{value:%H:%M:%S}"
},
"max": 101955467,
"min": 0,
"opposite": false,
"title": {
"text": "duration"
},
"type": "datetime"
}
]
}
1条答案
按热度按时间zed5wv101#
实际上,您希望获得总时间而不是DateTime。在这种情况下,您需要创建自己的标签格式化程序,将毫秒转换为小时、分钟和秒数。
示例代码:
API参考:https://api.highcharts.com/highcharts/series.column.dataLabels.formatter
演示:https://jsfiddle.net/BlackLabel/Lcjewr2o/