Advertisement
Guest User

chart

a guest
Apr 21st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Chart</title>
  4. <?php
  5. include_once("DB.php");
  6. $sql = mysql_query("SELECT * FROM pengaduan");
  7. while ($row = mysql_fetch_object($sql))
  8. {
  9. $status = $row->status;
  10. if($status=='0')
  11. {
  12. $status = "Baru";
  13. }
  14. else if($status=='1')
  15. {
  16. $status = "Proses";
  17. }
  18. else
  19. {
  20. $status = "Selesai";
  21. }
  22. if ($status == "Baru")
  23. {
  24. $baru = $baru + 1;
  25. }
  26. if ($status == "Proses")
  27. {
  28. $proses = $proses + 1;
  29. }
  30. if ($status == "Selesai")
  31. {
  32. $selesai = $selesai + 1;
  33. }
  34.  
  35. $num_rows = mysql_num_rows($result);
  36. // Display the results
  37. echo $num_rows; ?>
  38. <link href="style.css" rel="stylesheet" type="text/css">
  39. <link rel="stylesheet" type="text/css" href="../css/style.css">
  40. <script type="text/javascript" src="https://www.google.com/jsapi"></script>
  41. <script type="text/javascript">
  42. google.load("visualization", "1", {packages:["corechart"]});
  43. google.setOnLoadCallback(drawChart);
  44. function drawChart() {
  45. //==================Format Data======================
  46. var data = google.visualization.arrayToDataTable([
  47. ['Year', 'Sales'],
  48. ['2004', <?php echo $baru;?> ],
  49. ['2005', <?php echo $proses;?> ],
  50. ['2006', <?php echo $selsai;?> ]
  51. ]);
  52. //==================Format Data======================
  53.  
  54. //==================Setting Chart====================
  55. var options = {
  56. title: 'Company Performance',
  57. hAxis: {title: 'Year', titleTextStyle: {color: 'red'}}
  58. };
  59. //==================Setting Chart====================
  60.  
  61. var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
  62. chart.draw(data, options);
  63. }
  64. </script>
  65. <?php
  66. }
  67. ?>
  68. </head>
  69. <body>
  70. <div id="chart_div" style="width: 900px; height: 500px;"></div>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement