我有一个样条图表,我试图在30天前实现今天的通过率。基本上试图看到过去30天的增长。
然而,我看到x轴上的日期正在增加,并且它们将在10月/月增加1,这意味着9月26日将显示为第26届华侨城。
这是JS小提琴:http://jsfiddle.net/Mn6sB/1/
以下是高图表的代码 -
$(function () {
$('#container').highcharts({
chart: {
renderTo: 'chartContainer',
type: 'spline'
},
title: {
text: 'Pass rate statistics'
},
subtitle: {
text: 'Pass count per'
},
xAxis: {
type: 'datetime',
minTickInterval: 24 * 3600 * 1000,
dateTimeLabelFormats: {
month: '%e %b',
year: '%b'
}
},
yAxis: {
title: {
text: 'PassCount'
},
min: 0
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +
'</b><br/> Date: '+ Highcharts.dateFormat('%e %b',this.x)+
'</b><br/> Pass Count: '+ this.y;
}
},
series: [{name: 'development', data:[[Date.UTC(2013,8,27),10],[Date.UTC(2013,8,28),5],[Date.UTC(2013,8,29),12],[Date.UTC(2013,8,30),12],[Date.UTC(2013,8,31),7],[Date.UTC(2013,9,2),13],[Date.UTC(2013,9,3),22],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,5),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,9),7],[Date.UTC(2013,9,10),16],[Date.UTC(2013,9,11),20],[Date.UTC(2013,9,12),11],[Date.UTC(2013,9,13),25],[Date.UTC(2013,9,14),4],[Date.UTC(2013,9,15),11],[Date.UTC(2013,9,16),16],[Date.UTC(2013,9,17),12],[Date.UTC(2013,9,18),22],[Date.UTC(2013,9,19),10],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,24),40],[Date.UTC(2013,9,25),14],[Date.UTC(2013,9,26),6],]},{name: 'topbr', data:[[Date.UTC(2013,8,28),2],[Date.UTC(2013,8,29),1],[Date.UTC(2013,8,30),1],[Date.UTC(2013,8,31),1],[Date.UTC(2013,9,1),1],[Date.UTC(2013,9,2),1],[Date.UTC(2013,9,3),1],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,5),1],[Date.UTC(2013,9,6),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,9),1],[Date.UTC(2013,9,10),1],[Date.UTC(2013,9,11),1],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,13),1],[Date.UTC(2013,9,14),1],[Date.UTC(2013,9,16),1],[Date.UTC(2013,9,17),1],[Date.UTC(2013,9,18),1],[Date.UTC(2013,9,19),1],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,21),1],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,24),1],[Date.UTC(2013,9,25),1],[Date.UTC(2013,9,26),1],]},{name: 'xxsomething', data:[[Date.UTC(2013,8,28),10],[Date.UTC(2013,8,29),1],[Date.UTC(2013,8,30),1],[Date.UTC(2013,9,1),3],[Date.UTC(2013,9,6),10],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,9),3],[Date.UTC(2013,9,11),3],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,13),3],[Date.UTC(2013,9,14),3],[Date.UTC(2013,9,15),3],[Date.UTC(2013,9,16),3],[Date.UTC(2013,9,17),4],[Date.UTC(2013,9,18),42],[Date.UTC(2013,9,19),42],[Date.UTC(2013,9,20),41],[Date.UTC(2013,9,21),16],[Date.UTC(2013,9,24),4],[Date.UTC(2013,9,25),45],[Date.UTC(2013,9,26),2],]},{name: 'xxabcxos', data:[[Date.UTC(2013,8,30),1],[Date.UTC(2013,9,6),1],[Date.UTC(2013,9,25),1],]},{name: 'xxpqrs', data:[[Date.UTC(2013,8,28),2],[Date.UTC(2013,8,29),2],[Date.UTC(2013,8,30),1],[Date.UTC(2013,9,1),1],[Date.UTC(2013,9,2),1],[Date.UTC(2013,9,3),1],[Date.UTC(2013,9,4),1],[Date.UTC(2013,9,7),1],[Date.UTC(2013,9,8),1],[Date.UTC(2013,9,9),1],[Date.UTC(2013,9,10),1],[Date.UTC(2013,9,11),1],[Date.UTC(2013,9,12),1],[Date.UTC(2013,9,13),1],[Date.UTC(2013,9,15),1],[Date.UTC(2013,9,16),1],[Date.UTC(2013,9,17),1],[Date.UTC(2013,9,18),1],[Date.UTC(2013,9,19),1],[Date.UTC(2013,9,20),1],[Date.UTC(2013,9,21),2],[Date.UTC(2013,9,22),1],[Date.UTC(2013,9,23),1],[Date.UTC(2013,9,24),1],[Date.UTC(2013,9,25),1],]},{name: 'xxsomething_th', data:[[Date.UTC(2013,9,1),3],[Date.UTC(2013,9,24),4],]},{name: 'xxpqrs_dev', data:[[Date.UTC(2013,9,13),1],[Date.UTC(2013,9,21),1],]},{name: 'xxrel', data:[[Date.UTC(2013,9,15),1],]},{name: 'xxfun', data:[[Date.UTC(2013,8,28),2],[Date.UTC(2013,9,5),1],]},]
});
});
答案 0 :(得分:0)
使用日期时,月份从0开始,而不是1。
来自js控制台:
new Date( Date.UTC(2013,1,27) )
Tue Feb 26 2013 19:00:00 GMT-0500 (Eastern Standard Time)
new Date( Date.UTC(2013,0,27) )
Sat Jan 26 2013 19:00:00 GMT-0500 (Eastern Standard Time)