Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Chart</title>
- <?php
- include_once("DB.php");
- $sql = mysql_query("SELECT * FROM pengaduan");
- while ($row = mysql_fetch_object($sql))
- {
- $status = $row->status;
- if($status=='0')
- {
- $status = "Baru";
- }
- else if($status=='1')
- {
- $status = "Proses";
- }
- else
- {
- $status = "Selesai";
- }
- if ($status == "Baru")
- {
- $baru = $baru + 1;
- }
- if ($status == "Proses")
- {
- $proses = $proses + 1;
- }
- if ($status == "Selesai")
- {
- $selesai = $selesai + 1;
- }
- $num_rows = mysql_num_rows($result);
- // Display the results
- echo $num_rows; ?>
- <link href="style.css" rel="stylesheet" type="text/css">
- <link rel="stylesheet" type="text/css" href="../css/style.css">
- <script type="text/javascript" src="https://www.google.com/jsapi"></script>
- <script type="text/javascript">
- google.load("visualization", "1", {packages:["corechart"]});
- google.setOnLoadCallback(drawChart);
- function drawChart() {
- //==================Format Data======================
- var data = google.visualization.arrayToDataTable([
- ['Year', 'Sales'],
- ['2004', <?php echo $baru;?> ],
- ['2005', <?php echo $proses;?> ],
- ['2006', <?php echo $selsai;?> ]
- ]);
- //==================Format Data======================
- //==================Setting Chart====================
- var options = {
- title: 'Company Performance',
- hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
- };
- //==================Setting Chart====================
- var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
- chart.draw(data, options);
- }
- </script>
- <?php
- }
- ?>
- </head>
- <body>
- <div id="chart_div" style="width: 900px; height: 500px;"></div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement