Jargs
Jargs

Reputation: 695

Custom Horizontal Gridlines With Google Visualization API

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?

Upvotes: 2

Views: 1264

Answers (1)

asgallant
asgallant

Reputation: 26340

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.

Upvotes: 3

Related Questions