所以,我的数据格式只有H:M:S
没有日期所以在X轴上只有24小时。这就是我所拥有的:
Screenshot
我可以在图片上看到我的问题。数据范围差不多3天。但所有数据都在最后23-24小时内累积。这是因为新一天的小时没有出现在股票的开头。我该怎么做才能修复它?
我的剧本:
$(function() {
Highcharts.setOptions({
global: {
useUTC: true,
}
});
function requestData() {
$.ajax({
url: 'values2.php',
dataType: 'json',
async : true,
success: function(series) {
chart.addSeries({name: 'Events', data: series[0], yAxis:0}, false);
chart.redraw();
},
cache: false
});
}
chart = new Highcharts.StockChart({
chart: {
type: 'column',
shadow: false,
animation: false,
zoomType: 'xy',
renderTo: 'container',
events: {
load: requestData
}
},
title: {
text: 'Events on ECAL',
x: -20
},
rangeSelector: {
enabled: false,
allButtonsEnabled: true,
buttons: [{
type: 'hour',
count: 1,
text: '1 h'
}, {
type: 'hour',
count: 12,
text: '12 h'
}, {
type: 'day',
count: 1,
text: '1 day'
}, {
type: 'all',
text: 'all'
}],
buttonTheme: {
width:60
},
selected: 2
},
tooltip: {
xDateFormat: '%H-%M-%S',
shared: true
},
xAxis: {
type: 'datetime',
minTickInterval:100000,
labels: {
formatter: function() {
return Highcharts.dateFormat("%H:%M:%S", this.value);
}
}
},
plotOptions: {
series: {
pointWidth: 5,
dataGrouping: {
enabled: true,
units: [
[
'hour',
[1]
]]
}
}
},
yAxis: [{
labels: {
style: {
color: Highcharts.getOptions().colors[0]
}
},
title: {
text: 'Events',
style: {
color: Highcharts.getOptions().colors[0]
}
},
opposite: false
}],
legend: {
enabled: true,
align: 'left',
backgroundColor: '#DBFFDB',
borderColor: 'black',
borderWidth: 2,
layout: 'vertical',
verticalAlign: 'top',
y: 0,
x: 340,
floating: true,
shadow: false
},
tooltip: {
},
series: [
]
});
});
JSON文件的一部分:
[[60866000,1],[60870000,1],[60886000,1],[60888000,1],[60893000,1],[60894000,1],[60897000,1],[60904000,1],[60905000,1],[60916000,1]]
谢谢