我正在尝试使用jqPlot更改绘图中存在的刻度数。我正在为我的x轴使用dateAxisRenderer插件,并希望减少显示的日期刻度数。这是我的示例代码:
var dummyData = [['2011-05-03 10:15:30', 25], ['2011-05-04 11:30:30', 30], ['2011-05-05 10:15:30', 25], ['2011-05-06 11:30:30', 33], '2011-05-07 10:15:30', 25]];
$.jqplot(chartId, [dummyData], {
grid:{
//background:'#f0ffff',
background:'#F0F8FF',
gridLineColor:'#dfdfdf',
borderWidth:1.5
},
axes:{
xaxis:{
pad:1.0,
renderer:$.jqplot.DateAxisRenderer,
numberTicks:3,
tickOptions:{
formatString:'%#m/%#d%n%#I%p',
fontSize:'7pt',
fontFamily:'"Lucida Grande",Verdana, Georgia, "Times New Roman", Times, serif'
}
},
yaxis:{padMin:1.01, padMax:1.1, tickOptions:{formatString:'$%d'}}
},
seriesDefaults: {
fill: true,
fillAndStroke: true,
shadow:false,
rendererDefaults: {
highlightMouseOver:false,
highlightMouseDown:false,
highlightColor:null
},
markerOptions:{
show:false,
size:4
},
trendline:{
show:false,
type:'exp'
}
},
series:[{color:'rgba(255, 117, 26, 0.7)'}]
});
答案 0 :(得分:4)
$ .jqplot.DateAxisRenderer有一个tickInterval
选项。
例如:
xaxis: {
pad:1.0,
renderer:$.jqplot.DateAxisRenderer,
tickInterval: "7 days",
},