这里我想在y轴上显示持续时间但不显示,我写了以下一系列数据。
series: [{
name: 'Months',
data: ["00:00:10", "00:42:10","01:00:00","21:00:10","05:10:10","12:00:10","05:00:10","02:00:10","00:50:10","00:40:10", "00:20:10", "10:10:10"]
}]
请检查我曾试过但没有显示的jsfiddle http://jsfiddle.net/tank_hit/4usn4tp0/。
如何实现这一目标?
答案 0 :(得分:0)
您需要将字符串转换为数字。在你的情况下,它应该是毫秒数。然后将yAxis.type
设置为"linear"
并查看结果http://jsfiddle.net/4usn4tp0/3/
代码:
yAxis: {
min: 0,
showFirstLabel: false,
type: "datetime",
labels: {
formatter: function () {
var ts = this.value,
hs = ts / (3600 * 1000),
ms = new Date(ts).getUTCMinutes();
ms = ms < 10 ? '0' + ms : ms;
hs = hs < 10 ? '0' + hs : hs;
return hs + ":" + ms;
}
}
},
series: [{
name: 'Months',
data: [ 10 * 60 * 1000, 42 * 60 * 1000, 60 * 60 * 1000]
}]