BackgroundColor fill none

23 views
Skip to first unread message

Mark Lankhorst

unread,
Feb 15, 2016, 9:32:23 AM2/15/16
to Google Visualization API
Hi all,

I'm working with the Google charts for a few days, but the backgroundColor fill option is not working in my chart.

The code i'm using:

<script type="text/javascript">
// Load the Visualization API and the chart packages.
google.charts.load('current', {'packages': ['gauge', 'bar'], 'language': 'nl'});
// Set a callback to run when the Google Visualization API is loaded.
google.charts.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the charts, passes in the data and
// draws them.
function drawChart() {
    // Create the data table.
    var BarData = new google.visualization.arrayToDataTable([
          ['', 'Kosten', 'Target', 'Opbrengst'],
          [' ', 1, 2, 3]

    ]);
 var BarOptions = {
          bars: 'vertical',
          vAxis: {format: 'currency'},
          height: 150,
          width: 340,
          backgroundColor: {fill: 'none'},
          colors: ['#3265cb', '#109617', '#e9573f']
    };
    var BarChart = new google.charts.Bar(document.getElementById(
        'bar_chart'));
    BarChart.draw(BarData, BarOptions);
    };
</script>

Hope someone can help me.

Mark

Sergey Grabkovsky

unread,
Feb 16, 2016, 10:24:53 AM2/16/16
to Google Visualization API
Hi Mark,

As documented on our BarChart documentation page, in order to use the Material Bar chart with the old options (which is the only documented way of using it at the moment), you have to call google.charts.Bar.convertOptions on your options structure.

Here is a working jsfiddle of your example: http://jsfiddle.net/secb0bk3/

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/304d80f6-e821-4225-8955-bec556c32812%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

unnamed.gif

Sergey Grabkovsky

Software Engineer

Google, Inc

gra...@google.com


Reply all
Reply to author
Forward
0 new messages