I'm using the Google Chart API (not Google Image Chart) to create a line chart with dates on the x axis (bottom) and numbers on the y axis (left). I want to add an r axis (right) with string labels.
If I understand the following page correctly, it's only possible to have strings on the major axis (x axis for line chart). The minor axes (y and r axes) only accepts continuous values (like numbers) and not discrete values (like strings).
Customizing Axes
In Google Image Charts it is possible to work around this by assigning the string data to a value (say from 0 to 100) and assign custom string labels to the axis using the chxl parameter. This is especially easy if the data is evenly spaced.
I've looked at the API reference but can't find anything similar when using the Google Chart API.
Does anyone know if it's possible?
Best regards, JP
The simplest approach of all is to add the following to your graph options:
vAxis: { ticks: [{ v: 0, f: 'Zero'}, {v: 1, f: 'One'}, {v: 2, f: 'Two'}]}
In this example, I'm indicating that "Zero" should be displayed instead of 0, "One" instead of 1, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With