turt2live

Untitled

Jul 25th, 2012
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. <?php // content="text/plain; charset=utf-8"
  2. require_once ('jpgraph/jpgraph.php');
  3. require_once ('jpgraph/jpgraph_line.php');
  4. require_once ('getstat.php');
  5.  
  6. doInclude();
  7.  
  8. $title = $_GET['title'];
  9. $minutes = $_GET['minutes'];
  10. $axis = $_GET['naxis'];
  11. $data = array();
  12. $labels = array();
  13. for($i=0;$i<$axis;$i++){
  14.     $data[$i] = getStat($_GET['axisname'.$i], $minutes);
  15.     $labels[$i] = $_GET['axislabel'.$i];
  16. }
  17.  
  18. // Setup the graph
  19. $graph = new Graph(400,350);
  20. $graph->SetScale("textlin");
  21.  
  22. $theme_class=new UniversalTheme;
  23.  
  24. $graph->SetTheme($theme_class);
  25. $graph->img->SetAntiAliasing(false);
  26. $graph->title->Set($title);
  27. $graph->SetBox(false);
  28.  
  29. $graph->img->SetAntiAliasing();
  30.  
  31. $graph->yaxis->HideZeroLabel();
  32. $graph->yaxis->HideLine(false);
  33. $graph->yaxis->HideTicks(false,false);
  34.  
  35. $graph->xgrid->Show();
  36. $graph->xgrid->SetLineStyle("solid");
  37. $graph->xaxis->HideLabels();
  38. $graph->xgrid->SetColor('#E3E3E3');
  39.  
  40. for($i=0;$i<count($data);$i++){
  41.     $p = new LinePlot($data[$i]);
  42.     $graph->Add($p);
  43.     $p->SetColor(col($i));
  44.     $p->SetLegend($labels[$i]);
  45. }
  46.  
  47. $graph->legend->SetFrameWeight(1);
  48.  
  49. // Output line
  50. $graph->Stroke();
  51.  
  52. function col($index){
  53.     if($index == 0){
  54.         return "#6495ED";
  55.     }else if($index == 1){
  56.         return "#B22222";
  57.     }else if($index == 2){
  58.         return "#FF1493";
  59.     }else{
  60.         return "#FF1493";
  61.     }
  62. }
  63.  
  64. ?>
Advertisement
Add Comment
Please, Sign In to add comment