jqplot tickOptions formatString options

Greg Meyer picture Greg Meyer · Dec 20, 2012 · Viewed 19.9k times · Source

I'm incredibly new to web dev. What I'm finding frustrating are the options used in the axesRendererDefaults options in jqplot.

According to this link:

the way to specify how a tick will appear on the axis (either X or Y) will be determined by what is specified by the formatString: '' option.

What options are available for formatString option? In the tutorial given on the jqplot page, they pass options such as: %d, $%d and %n. How do I find the full list of options available?

Are these formatting options separate from jqplot and actually a property of jQuery?

Answer

Andy Lorenz picture Andy Lorenz · Mar 25, 2013

The format commands are similar (if not identical) to those for the sprintf function.

A decent reference for these is http://perldoc.perl.org/functions/sprintf.html

e.g. yaxis: { tickOptions: {formatString: '%.2f'} }

will output a floating point number to 2 decimal places.