<?php include_once 'kepala.php'; 
	$result = mysqli_query($ok->conn(),'Select * from toga');
?>

<html>
  <head>
    <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
    <script type="text/javascript">
  google.charts.load('current', {'packages':['corechart']});
  </script>
    <script type="text/javascript">
      google.charts.load("current", {packages:["corechart"]});
      google.charts.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([

          ['Marga', 'Jumlah'],

          <?php 
            while($user_data = mysqli_fetch_array($result)){
            	extract($user_data);
            	$ww =$ok->count($user_data['id_toga']);
            	echo "['{$nama_toga}',".$ww."],";
            } 
            
          ?>
        ]);

        var options = {
          title: 'My Daily Activities',
          is3D: true,
        };

        var chart = new google.visualization.PieChart(document.getElementById('piechart_3d'));
        chart.draw(data, options);
      }
    </script>
  </head>
  <body>
    <div id="piechart_3d" style="width: 900px; height: 500px;"></div>
  </body>
</html>