11

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
  • 19,970
  • 26
  • 98
  • 180

2 Answers2

11

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

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

RomainValeri
  • 14,254
  • 2
  • 22
  • 39
4

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

{vAxis: {gridlineColor: '#f0f'}}
surendrapanday
  • 349
  • 1
  • 11
alexeevyci
  • 251
  • 1
  • 3
  • 14