2

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'?

2 Answers 2

7

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/

6

To write a '%' sign you have to double it :

axes:
   {yaxis: 
        {tickOptions: 
               {formatString: '%%%d'}
        }
   }

%%%d will write '%10' if your value is 10. Similarly, %d%% will write '10%' if again your value is 10. So you just have to replace the '$' sign by '%%'.

Anthony.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.