Google Chart Setting Gridline Color
Asked Answered
C

2

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?

Coup answered 6/6, 2012 at 15:6 Comment(0)
C
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'}}

Citation answered 6/6, 2012 at 15:29 Comment(0)
M
6

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

{vAxis: {gridlineColor: '#f0f'}}
Mover answered 12/10, 2018 at 12:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.