forum

Home / DeveloperSection / Forums / Google chart with data from database

Google chart with data from database

Sunil Singh 1388 15-Dec-2017

I'm facing problem in binding google chart with database.

<script type="text/javascript">

    google.charts.load("current", { packages: ["corechart"] });
    google.charts.setOnLoadCallback(drawChart);
    function drawChart() {
        data = new google.visualization.DataTable();
        data.addColumn('string', 'Topping');
        data.addColumn('number', 'Slices');

        data.addRows([

          ['Onions', 1],
          ['Olives', 1],
          ['Zucchini', 1],
          ['Pepperoni', 2],

        ]);

        var options = {
            title: '',
            pieHole: 0.4,
        };

        var chart = new google.visualization.PieChart(document.getElementById('donutchart'));
        chart.draw(data, options);
    }
</script>

Updated on 15-Dec-2017

Can you answer this question?


Answer

1 Answers

Liked By