我正在创建以下jqlot
$.jqplot('chartdiv', JSON.parse(response.occnum), {
title: 'Occurrences',
legend: {
show: true,
renderer: $.jqplot.EnhancedLegendRenderer,
placement: "outsideGrid",
labels: response.labels,
location: "ne",
rowSpacing: "0px",
rendererOptions: {
// set to true to replot when toggling series on/off
// set to an options object to pass in replot options.
seriesToggle: 'normal',
seriesToggleReplot: {resetAxes: true}
}
},
seriesDefaults: {renderer:$.jqplot.BarRenderer},
axes: {
xaxis:{
label: 'Months',
tickOptions : {
tickInterval: 1}
},
yaxis: {
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
labelOptions:{
fontFamily:'Helvetica'
//fontSize: '14pt'
},
label: 'Occurrences number'
}
}
});
用以下数据喂养图
[[[7,4]],[[4,2],[5,1],[6,1],[7,1],[8,1]],[[5,2],[6,10],[7,6],[8,1]]]
并得到结果
我想在x轴上只得到0,1,2,3的整数值,而不是我现在得到的0.0,0.5,0.1等。
答案 0 :(得分:0)
使用formatString
选项将xaxis刻度格式化为整数。
tickOptions : {
formatString:'%d',
tickInterval: 1}
},
如果您将重复刻度(1,1,2,2 ...),您还可以添加numberTicks
选项,该选项设置将显示的确切滴答数。 Read about it here