Advertisement
Guest User

Untitled

a guest
Jun 8th, 2011
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. <?php
  2.  
  3. include ('config.php');
  4. mysql_select_db ($dbc, $login);
  5.  
  6. // -->> PRES TOTO JSEM TO ZKOUSEL,ALE JAKSI MI TO NEFUNGOVALO
  7. ///////////////////////////////////////////////////////////////////////////
  8. $data = mysql_query("select `ali`,`horda` from `graf_bayer` where `realmid`='1'")or die("Nelze se připojit k MySQL: " . mysql_error());
  9. $stop=mysql_num_rows($data);
  10. mysql_free_result($data);
  11.  
  12. $start=$stop-1500;
  13.  
  14. if ($start < 0)
  15. $start = 0;
  16.  
  17. $data = mysql_query("select `aliance`,`horda`,TIME(`date`) as `datum` from `check` where `server`='1' limit $start,$stop")or die("Nelze se připojit k MySQL: " . mysql_error());
  18.  
  19. $i=0;
  20.  
  21. while($row=mysql_fetch_array($data))
  22. {
  23. $horda[$i]=$row[horda];
  24. $ali[$i]=$row[aliance];
  25. //if ($i%360 == 0) // viz tick interval, mensi vyuziti pameti (funguje s i bez)
  26. $timestamps[$i]=$row[datum];
  27. $i++;
  28. }
  29.  
  30. $horda[$i]=1;
  31. $ali[$i]=1;
  32. $timestamps[$i] = 1;
  33. /////////////////////////////////////////////////////////////////////////////////////
  34. // -->> PRES TOTO JSEM TO ZKOUSEL,ALE JAKSI MI TO NEFUNGOVALO
  35. require_once ('jpgraph/jpgraph.php');
  36. require_once ('jpgraph/jpgraph_line.php');
  37.  
  38. $datay1 = array(3,4,5);
  39. $datay2 = array(4,5,6);
  40. $datay3 = array(7,8,9);
  41. $datay4 = array(0,0);
  42.  
  43. // Setup the graph
  44. $graph = new Graph(800,500);
  45. $graph->SetScale("textlin");
  46.  
  47. $theme_class=new SoftyTheme;
  48.  
  49. $graph->SetTheme($theme_class);
  50. $graph->img->SetAntiAliasing(false);
  51.  
  52. $graph->SetBox(false);
  53.  
  54. $graph->img->SetAntiAliasing();
  55.  
  56. $graph->yaxis->HideZeroLabel();
  57. $graph->yaxis->HideLine(false);
  58. $graph->yaxis->HideTicks(false,false);
  59.  
  60. $graph->xgrid->Show();
  61. $graph->xgrid->SetLineStyle("solid");
  62. $graph->xaxis->SetTickLabels(array('1','2','3','4'));
  63. $graph->xgrid->SetColor('black');
  64. //////////////////////////////////////////////////////////////////////////
  65.  
  66. ////////////////////////////////////////////
  67. // Create the first line
  68. $p1 = new LinePlot($datay1);
  69. $graph->Add($p1);
  70. $p1->SetColor("blue");
  71. $p1->SetLegend('Alliance');
  72.  
  73. // Create the second line
  74. $p2 = new LinePlot($datay2);
  75. $graph->Add($p2);
  76. $p2->SetColor("red");
  77. $p2->SetLegend('Horde');
  78.  
  79. $p3 = new LinePlot($datay3);
  80. $graph->Add($p3);
  81. $p3->SetColor("green");
  82. $p3->SetLegend('Celkem');
  83.  
  84. $p4 = new LinePlot($datay4);
  85. $graph->Add($p4);
  86. $p4->SetColor("black");
  87.  
  88.  
  89. $graph->legend->SetFrameWeight(4);
  90.  
  91. // Output line
  92. $graph->Stroke();
  93. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement