JQplot Format String

Garry picture Garry · Jan 16, 2013 · Viewed 8.7k times · Source

Can I please have some help to format the string on the Y Axis that has a '%' sign.

Here is the code for a '$':

tickOptions: {formatString: '$%d'}

How do I format the string to use a '%' sign as the '%' sign is used as a 'keyword'?

Answer

Pablo Claus picture Pablo Claus · Jan 17, 2013

Try something like this:

tickFormatter = function (format, val) { 
return val+"%";
}

And add this option to the plot:

axes: {
 yaxis: {
 tickOptions: {
  formatter: tickFormatter
 }
}

http://jsfiddle.net/pabloker/9ZrKA/3/