mardi 23 février 2016

Replacing int by variable from php mysql database in Google chart

i have below code from google chart to produce a pie chart. Now what i want to do is to replace the int by the count of a specific field from database. Any help how ? from php the count i usually echoed as

and code for Pie chart :

  google.charts.load("current", {packages:["corechart"]});
  google.charts.setOnLoadCallback(drawChart);
  function drawChart() {
    var data = google.visualization.arrayToDataTable([

      ['Course', 'No. Of Students'],
      ['BSc Information System',     11],
      ['BSc English',      2],
      ['BSc Engineering',  2],
      ['BSc Computer Science', 2],
      ['BSc Social Science',    7]
    ]);

    var options = {
      title: 'Student Statistics',
      is3D: true,
    };

    var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
    chart.draw(data, options);
  }




Aucun commentaire:

Enregistrer un commentaire