Advertisement
Guest User

Untitled

a guest
Jun 9th, 2011
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.24 KB | None | 0 0
  1. <?php
  2.  
  3. include ('config.php');
  4. mysql_select_db ($dbc, $login);
  5.  
  6. /////////////////////////////////////////////////////////////////////////////////////
  7.  
  8. /* !!!!!! */
  9. $data = mysql_query("select count(*) from `graf_bayer` where `realmid`='1'")or die("Nelze se připojit k MySQL: " . mysql_error());
  10. $stop=mysql_result($data,0);
  11. mysql_free_result($data);
  12.  
  13. $start=$stop-1500;
  14.  
  15. if ($start < 0)
  16.    $start = 0;
  17.  
  18. /* !!!!!! */  
  19. $data = mysql_query("select `ali`,`horda`,TIME(`date`) as `cas` from `graf_bayer` where `realmid`='1' limit $start,$stop")or die("Nelze se připojit k MySQL: " . mysql_error());
  20.  
  21. /* !!!!!! */
  22. $i=0;
  23. while($row=mysql_fetch_array($data))
  24. {
  25.   $ali[$i]=$row['ali'];
  26.   $horda[$i]=$row['horda'];
  27.   $celkem[$i]=$row['ali'] + $row['horda'];
  28.   //if ($i%360 == 0) // viz tick interval, mensi vyuziti pameti (funguje s i bez)
  29.   $timestamps[$i]=$row['cas'];
  30.   $i++;
  31. }
  32.  
  33. /////////////////////////////////////////////////////////////////////////////////////
  34.  
  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. /* !!!!!! */
  63. $graph->xaxis->SetTickLabels($timestamps);
  64. $graph->xgrid->SetColor('black');
  65.  
  66. //////////////////////////////////////////////////////////////////////////
  67.  
  68. /* !!!!!! */
  69. $p1 = new LinePlot($ali);
  70. $graph->Add($p1);
  71. $p1->SetColor("blue");
  72. $p1->SetLegend('Alliance');
  73.  
  74. /* !!!!!! */
  75. $p2 = new LinePlot($horda);
  76. $graph->Add($p2);
  77. $p2->SetColor("red");
  78. $p2->SetLegend('Horde');
  79.  
  80. /* !!!!!! */
  81. $p3 = new LinePlot($celkem);
  82. $graph->Add($p3);
  83. $p3->SetColor("green");
  84. $p3->SetLegend('Celkem');
  85.  
  86. $p4 = new LinePlot($datay4);
  87. $graph->Add($p4);
  88. $p4->SetColor("black");
  89.                  
  90.  
  91. $graph->legend->SetFrameWeight(4);
  92.  
  93. // Output line
  94. $graph->Stroke();
  95. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement