我想在列顶部显示日期时间格式,当我尝试显示列标签时,它显示不正确的结果,格式不正确。我在工具提示中(悬停)而不是在标签中获得了正确的数据。
获取操作-86340000
预期操作-23:59
代码
$('#container3').highcharts({
credits: {
enabled: false
},
chart: {
type: 'column'
},
xAxis:{
type: 'datetime',
tickInterval: 24 * 3600 * 1000 * 1,
dateTimeLabelFormats: { //force all formats to be hour:minute:second
day: '%e-%m-%Y',
}
},
title: {
text: 'Report'
},
yAxis: {
type: 'datetime',
dateTimeLabelFormats: { //force all formats to be hour:minute:second
second: '%H:%M',
minute: '%H:%M',
hour: '%H:%M',
day: '%H:%M',
week: '%H:%M',
month: '%H:%M',
year: '%H:%M'
}
},
plotOptions: {
column: {
dataLabels: {
enabled: true,
y: -20,
verticalAlign: 'top'
}
}
},
tooltip: {
pointFormat: "<span style='color:{point.color}'>\u25CF</span> {series.name}: <b>{point.label}</b><br/>"
},
series: [{
name: 'On Duration',
data: OnData
}, {
name: 'Off Duration',
data: OffData
}]
});
我获得了必需的数据,当我使用format选项时,数据按要求进行了格式化
plotOptions: {
column: {
dataLabels: {
enabled: true,
y: -20,
verticalAlign: 'top',
format: '{point.label}'
}
}
},