2

Is it possible to add horizontal gridlines at irregular intervals to a Google Visualization ColumnChart? Something similar to the Good, Better, Best markers on this image chart:

Image chart with arbitrary gridlines

I have tried to figure it out myself, but have only found ways to add gridlines at regular intervals. Nothing at arbitrary locations.

If Google Visiualization can't do this, can anyone suggest a good javascript svg charting library that can?

Jargs
  • 675
  • 3
  • 10
  • 22

1 Answers1

3

Use the vAxis.ticks option:

vAxis: {
    ticks: [{v: 1, f: 'Good'}, {v: 3, f: 'Better'}, {v: 4, f: 'Best'}]
}

Each element in the ticks array is an object with v and f properties: the v property is the value to place the label at, and the f property is the label to use.

jmac
  • 7,078
  • 2
  • 29
  • 57
asgallant
  • 26,060
  • 6
  • 72
  • 87
  • That did the trick! Thank you! Just for accuracy sake, there is a minor typo in your example code. The colon after the 3 should be a comma. Thanks again! – Jargs Jan 09 '14 at 00:21
  • @Jeff, nice catch. Fixed the colon/comma issue for him. – jmac Jan 09 '14 at 06:20