0
我有一個樣條圖,我試圖從今天開始實現30天的通過率。基本上試圖在過去30天內看到增長。Highcharts問題與日期
但是我看到日期在x軸上的日期,他們將在十月/月加1,這意味着9月26日一些如何顯示爲10月26日。使用日期時
$(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],]},]
});
});
所以你說的圖表應該從8月26日至Sep.26? – Sualkcin
如果是這樣,當使用Date時,月份從0開始索引,而不是1。因此,不要使用8月份的自然'8',您需要使用'7'。 – Sualkcin
是的。謝謝。它以這種方式工作。 –