Skip to content Skip to sidebar Skip to footer

JQplot FormatString "%n"

I've a little problem with jQplot. I'm trying to do a DateAxisRenderer like this : http://tinyurl.com/p8v5coh And i've this : http://tinyurl.com/qd2lbxh I don't want to make a rota

Solution 1:

jqplot sometimes does strange things with axes and labels. That's why I usually manually define my own axes ticks like this:

axes: {
            xaxis: {
                tickRenderer: $.jqplot.CanvasAxisTickRenderer,
                labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
                label: 'Date',
                tickOptions:{formatString:'%b %Y'},
                pad: 0,
                ticks: lsTicks,
                renderer: $.jqplot.DateAxisRenderer
            },

where lsTicks looks lomething like this:

["2014-01", "2014-02", "2014-03", "2014-04"]

and its length is the same as your data. To make things more readable, you can add tickOptions: {angle: -20},, so that your dates come in at an angle if you have too many to fit next to each other.

tickOptions:{formatString:'%b %Y'} says: display a 3 letter month, then a 4 digit year. For more options and info, see here.

Alternatively, you can use min, max and tickInterval, but I have found that they misbehave sometimes. See here and here for more.


Post a Comment for "JQplot FormatString "%n""