Google Chart Setting Gridline Color

Luke picture Luke · Jun 6, 2012 · Viewed 10.8k times · Source

I'm trying to set the color of the gridlines in the background of my Graph using Google Charts.

I've got this code for setting the options of the chart:

ac.draw(activityData, {
    title : 'Monthly Coffee Production by Country',
    isStacked: true,
    width: 600,
    height: 400,
    fontSize: 0,
    backgroundColor: '#1E4D6B',
        hAxis.gridlines.color: '#1E4D6B'
});

However, I don't know how to use the options like hAxis.gridlines.color within my code that appear in the configuration options page.

If I simply put hAxis.gridlines.color, it comes up with an error in the console of:

Uncaught SyntaxError: Unexpected token .

What is the correct syntax to make use of the options that contain periods?

Answer

RomainValeri picture RomainValeri · Jun 6, 2012

It's an object litteral you're passing as second parameter of draw(), so I guess it should instead be :

hAxis: {gridlines: {color: '#1E4D6B'}}