Skip to content Skip to sidebar Skip to footer

Google Charts Backgroundcolor Not Working With Example Code

I use code from example page to create horizontal bars chart: Option backgroundColor work for other chart types, like this and that. Is there are way to change background color for

Solution 1:

You're using a Material Bar chart (See the relevant documentation here.) See the comment at the end of the documentation paragraph :

The Material Charts are in beta. The appearance and interactivity are largely final, but the way options are declared is not. If you are converting a Classic Bar Chart to a Material Bar Chart, you'll want to replace this line:

chart.draw(data, options);

...with this:

chart.draw(data, google.charts.Bar.convertOptions(options));

So if you want your standard options taken into account you need to wrap them with google.charts.Bar.convertOptions().

Have a try, it works great. See a jsfiddle of it here.

Post a Comment for "Google Charts Backgroundcolor Not Working With Example Code"