remove background from google Chart

Asked

Viewed 850 times

3

Colleagues.

I’m using Google Chart in a project, only when installing it in this project, it overlaps the div where it is. How would I put transparent the bottom of the Chart?

inserir a descrição da imagem aqui

1 answer

4


Puts backgroundColor: 'transparent' within the options of the graph.

      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>
       <div id="piechart" style="width: 900px; height: 500px;"></div>

  • 1

    Thank you Taisbevalle. It worked!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.