Luke
Luke

Reputation: 23690

Google Chart Setting Gridline Color

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?

Upvotes: 12

Views: 13097

Answers (2)

alexeevyci
alexeevyci

Reputation: 281

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

{vAxis: {gridlineColor: '#f0f'}}

Upvotes: 7

Romain Valeri
Romain Valeri

Reputation: 22057

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

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

Upvotes: 12

Related Questions