Google Charts (JS) - is there a way of using a transparent background on a chart?

Google Visualization

Google Visualization Problem Overview


I'm using the Google Charts API to include various graphs on a webapp I'm working on. I'm using the javascript chart tools (not the image chart tools), and am wondering if it's possible to use a transparent background on a chart (e.g. line graph, pie chart, etc.)?

Google Visualization Solutions


Solution 1 - Google Visualization

In the Configuration Options of the chart, specify

backgroundColor: { fill:'transparent' }

This worked for me in Chrome and Firefox. It took me some time to find out. The doc page says you can only put in HTML color strings and I assumed 'transparent' was not one of them.

Solution 2 - Google Visualization

Setting a transparent background for Google Charts:

// Set chart options
var options = {'title':'Chart Title',
'width':600,
'height':300,
'backgroundColor': 'transparent',
'is3D':true
};

JSFIDDLE DEMO

Solution 3 - Google Visualization

backgroundColor: "00000000" worked for me.

Solution 4 - Google Visualization

If nothing works for you try locating the background rectangle at the end of your drawChart() function and add the fill-opacity attribute.

 fill-opacity="0.0"

Example:

$('#mychart').find('svg rect:eq( 1 )').attr('fill-opacity','0.0');

Use the eq:() selector to select the rectangle you want to be transparent.

Solution 5 - Google Visualization

On the left of the cart there is a dropdown arrow - click that, and go to "cop chart".

When you paste the chart, you can still choose to link it, and it will paste with the background transparent.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjohnethView Question on Stackoverflow
Solution 1 - Google VisualizationmaxjakobView Answer on Stackoverflow
Solution 2 - Google VisualizationPorta ShqipeView Answer on Stackoverflow
Solution 3 - Google VisualizationRafa LlorenteView Answer on Stackoverflow
Solution 4 - Google VisualizationJonas LittauView Answer on Stackoverflow
Solution 5 - Google VisualizationZach SimonsView Answer on Stackoverflow