12

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?

Luke
  • 22,826
  • 31
  • 110
  • 193

2 Answers2

12

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

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

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
6

gridlineColor: '#f0f' also works, and this is how you do it.

{vAxis: {gridlineColor: '#f0f'}}
surendrapanday
  • 530
  • 3
  • 13
alexeevyci
  • 271
  • 1
  • 5
  • 16