我有一个图表,我昨天和今天早上在jsFiddle上做了一点:
http://jsfiddle.net/XJES3/6/如果你看,你会发现列的xAxis标签并不总是显示出来。我肯定有一个设置,迫使他们总是显示或可能有一种方法来设置间隔,但我在API文档中找不到它。如果有人能给我指出正确的方向,我会很高兴的。
Thanks a bunch.
Highcharts代码如下:
var go_local_scriblio_authority_history = new Highcharts.Chart({
chart: {
renderTo: 'go-local-scriblio-authority-history',
type: 'column'
},
credits: {
enabled:false
},
title: {
text: null
},
subtitle: {
text: null
},
xAxis: {
type: 'datetime',
labels: {
step: 1,
rotation: -90,
style: {
fontSize: '10px',
fontFamily: 'Helvetica, sans-serif',
color: '#629bc0'
},
x: 3,
formatter: function() {
return Highcharts.dateFormat('%b', this.value).toUpperCase();
}
},
reversed: false,
lineColor: '#ffffff',
tickColor: '#ffffff'
},
yAxis: {
min: 0,
labels: false,
title: false,
gridLineColor: '#ffffff',
},
legend: false,
tooltip: {
formatter: function() {
return '<strong>' + Highcharts.dateFormat('%b %Y', this.x) + ':</strong> ' + this.y;
}
},
series: [{
name: 'Article Counts by Month',
color: '#629bc0',
data: [[Date.UTC(2013, 2, 1),2], [Date.UTC(2013, 1, 1),22], [Date.UTC(2012, 12, 1),11], [Date.UTC(2012, 11, 1),22], [Date.UTC(2012, 10, 1),28], [Date.UTC(2012, 9, 1),37], [Date.UTC(2012, 8, 1),38], [Date.UTC(2012, 7, 1),60], [Date.UTC(2012, 6, 1),87], [Date.UTC(2012, 5, 1),53], [Date.UTC(2012, 4, 1),62], [Date.UTC(2012, 3, 1),51], [Date.UTC(2012, 2, 1),29], [Date.UTC(2012, 1, 1),54], [Date.UTC(2011, 12, 1),50], [Date.UTC(2011, 11, 1),49], [Date.UTC(2011, 10, 1),45], [Date.UTC(2011, 9, 1),40], [Date.UTC(2011, 8, 1),42], [Date.UTC(2011, 7, 1),50], [Date.UTC(2011, 6, 1),48], [Date.UTC(2011, 5, 1),57], [Date.UTC(2011, 4, 1),44], [Date.UTC(2011, 3, 1),52]]
}],
plotOptions: {
series: {
borderWidth: 0,
shadow: false,
pointWidth: 10,
pointPadding: 0,
groupPadding: 0,
}
}
});
您需要设置tickInterval:http://api.highcharts.com/highcharts xAxis.tickInterval
http://jsfiddle.net/XJES3/7/tickInterval:86400*30 * 1000, //30 days, in miliseconds