如何从这样构造的json对象在x轴上显示日期;
[
[
634420512000000000,
100000
],
[
634421376000000000,
100086
],
[
634422240000000000,
100171
],
[
634423104000000000,
100257
]
]
我的日期以毫秒为单位。我已经像这样设置了xAxis;
xAxis: {
title: {
text: 'Time'
},
type: 'datetime'
}
结果是从1970年1月1日起,我返回的是滴答声,而不是毫秒数
所以...
Dim dt1970 As DateTime = New DateTime("1970", "1", "1")
Dim d As DateTime = row("myDateFromDB")
Dim span As TimeSpan = d - dt1970
Dim milli as long = span.TotalMilliseconds
Highcharts接受三种主要的数据格式:
[1, 2, 3]
)[[x, y], [x2, y2]]
)关于这些格式的更多详细信息,请参见in the highcharts documentation。但是,就您而言,这应该很容易。只需执行以下操作即可。
var data = []; //assume data is the array you've listed in your question
var chart = new Highcharts.chart({
xAxis: {
title: {
text: 'Time'
},
type: 'datetime'
},
series: [{
data: data
}]
});