是否可以在高位图x轴上显示日期时间,包括毫秒?我有相同的时间和秒记录不同的数据,但不同的毫秒。这是我的样本数据。
"startDate": {
"type": "date",
"format": "yyyy-MM-dd"
},
但在高级图表中它只显示日期和时间(HH:MM:SS)。我想用毫秒(HH:MM:SS.Mi)
显示它答案 0 :(得分:2)
您可以使用xAxis.dateTimeLabelFormats
。将时间格式指定为millisecond: '%H:%M:%S.%L'
var data = [ [ "1507104333940", 209.231 ], [ "1507104333950", 208.715 ], [ "1507104333960", 207.933 ], [ "1507104333970", 207.112 ], [ "1507104333980", 206.634 ], [ "1507104333990", 206.638 ], [ "1507104334000", 206.132 ], [ "1507104334010", 205.197 ], [ "1507104334020",204.713 ], [ "1507104334030", 204.415 ]].map(a => [+a[0], a[1]]);;
Highcharts.chart('chart', {
title: {
text: 'Chart with time'
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: {
millisecond: '%H:%M:%S.%L'
}
},
series: [{
data: data
}]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<div id="chart"></div>