我有一张图表,我昨天和今天早上在jsFiddle上做了一些工作:
如果你看起来你会看到列的xAxis标签并不总是出现。我确定在某个地方有一个设置迫使他们总是显示或可能设置间隔的方法,但我到目前为止在API文档中找不到它。如果有人能指出我正确的方向,我会很高兴。
非常感谢。
下面的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,
}
}
});
答案 0 :(得分:1)
您需要设置tickInterval: http://api.highcharts.com/highcharts#xAxis.tickInterval
tickInterval:86400*30 * 1000, //30 days, in miliseconds