1 回答
TA贡献1836条经验 获得超4个赞
您可以根据您的数据计算min和属性:max
var oneHour = 1000 * 60 * 60;
Highcharts.chart('container', {
time: {
useUTC: false
},
xAxis: {
type: 'datetime',
startOnTick: false,
endOnTick: false,
tickInterval: oneHour,
min: new Date(data.data[0].time.split(' ')[0]).getTime(),
max: (new Date(data.data[0].time.split(' ')[0]).getTime()) + oneHour * 24
},
series: [{
data: data.data.map(el => [
new Date(el.time).getTime(),
el.value
])
}]
});
现场演示: http: //jsfiddle.net/BlackLabel/vzs1odqr/
API参考:
https://api.highcharts.com/highcharts/xAxis.min
https://api.highcharts.com/highcharts/xAxis.max
添加回答
举报