remove background from google chart

3

Colleagues.

I'm using Google Chart in a project, but when I install it in this project, it overlaps the div where it is. How would I make the Chart background transparent?

    
asked by anonymous 31.01.2017 / 18:53

1 answer

4

Set backgroundColor: 'transparent' within the options of the chart.

      google.charts.load('current', {'packages':['corechart']});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {

        var data = google.visualization.arrayToDataTable([
          ['Tarefas', 'Avaliações'],
          ['Português', 11],
          ['Matematica', 2],
          ['Física', 2],
          ['Inglês', 2],
          ['Geografia',    7]
        ]);

        var options = {
          title: 'Avaliações por matérias',
          backgroundColor: 'transparent',
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart'));

        chart.draw(data, options);
      }
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script><divid="piechart" style="width: 900px; height: 500px;"></div>
    
31.01.2017 / 19:28