How to format jqplot yaxis as integer
How can I format the yy-axis strings so that they are integers and not decimal. Currently tickets are shown with numbers like 076165412.654666666666 and I would like them to show as 76165412 instead.
var data = [['2013/02/11',20130211],['2013/02/10',20130210],['2013/02/12',20130212],['2013/02/15',20130215],['2013/02/16',71],['2013/02/17',81],['2013/02/18',71],['2013/02/06',735],['2013/02/19',90]];
var options = {
title: 'Monthly statistics for EnrAll',
autoscale:true,
axes: {
xaxis: {
renderer: $.jqplot.DateAxisRenderer,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
min:'Feb 01, 2013',
max:'Feb 20, 2013',
numberTicks: 15,
tickOptions: {
formatString:'%b %#d',
angle: 15
}
},
yaxis: {
label: 'Count',
min:'0'
}
},
highlighter: {
show: true,
tooltipFadeSpeed: 'fast'
}
};
+3
source to share
1 answer
All I did to fix this was to change the way of specifying the minimum y-axis value.
Currently you have min:'0'
, change it to min:0
(i.e. a number, not a string). For further insurance, you can set tickOptions
and force the whole view, although I didn't need it myself:
tickOptions: {
formatString: '%d'
}
+4
source to share