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?
Select a chart and then on the right, open the STYLE tab. Data coloring options appear in the Color by section.
Changing the Color You can change the color of the lines that connect data points in Google Charts in two subtly different ways: with the colors option to change the chart palette, or with the series option to specify the color for particular series. In the following chart, we set the color of each series explicitly.
To apply a preset theme, select Format > Theme and choose an option, or to create a custom theme, select Customize in the top right.
It's an object litteral you're passing as second parameter of draw(), so I guess it should instead be :
hAxis: {gridlines: {color: '#1E4D6B'}}
gridlineColor: '#f0f'
also works, and this is how you do it.
{vAxis: {gridlineColor: '#f0f'}}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With