Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.12 KB | None | 0 0
  1. <?php
  2. // header("Content-type: image/png");
  3.  
  4. require("../config/connection.php");
  5.  
  6. $sql="SELECT COUNT(tanggal) as jlh, tanggal from gempa group by mounth(tanggal)";
  7.  
  8. $res = mysqli_query($sql) or die('Sql Sintaks Error...');
  9.  
  10. $data1y = array();
  11. $labels = array();
  12. $i=0;
  13. while($row=mysql_fetch_object($result)){
  14.     $jumlah = $row->jlh;
  15.     $tanggal = $row->tanggal;
  16.     $a = substr($tanggal, 5, 2);
  17.     $data1y[$i]=$jumlah;
  18.     $labels[$i]=$a;
  19.     $i++;
  20. }
  21.  
  22. $graph = new Graph(400, 300, 'auto');
  23. $graph->SetScale('textlin');
  24.  
  25.  
  26. $theme_class = new AquaTheme;
  27. $graph->SetTheme($theme_class);
  28. // after setting the theme, you can change individual details yourself
  29. $graph->SetFrame(true,'lightgray');                        // make frame visible and set color
  30. $graph->xaxis->SetTickLabels($labels); // change xaxis lagels
  31. $graph->title->Set("Theme Example");                    // add title
  32.  
  33. // add barplot
  34. $bplot = new BarPlot($data1y);
  35.  
  36. // you can change properties of the plot only after calling Add()
  37. $bplot->SetWeight(0);
  38. $bplot->SetFillGradient('#FFAAAA:0.7', '#FFAAAA:1.2', GRAD_VER);    
  39.  
  40. $graph->Stroke();
  41.  
  42.  
  43. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement