Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ("./jpgraph.php");
- include ("./jpgraph_line.php");
- include 'config.php';
- mysql_connect($db_server,$db_user,$db_pass) or die("Nelze se připojit k MySQL: " . mysql_error());
- mysql_select_db($mangos_db);
- $data = mysql_query("select `aliance`,`horda` from `check` where `server`='1'")or die("Nelze se připojit k MySQL: " . mysql_error());
- $stop=mysql_num_rows($data);
- mysql_free_result($data);
- $start=$stop-1500;
- if ($start < 0)
- $start = 0;
- $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());
- $i=0;
- while($row=mysql_fetch_array($data))
- {
- $horda[$i]=$row[horda];
- $ali[$i]=$row[aliance];
- //if ($i%360 == 0) // viz tick interval, mensi vyuziti pameti (funguje s i bez)
- $timestamps[$i]=$row[datum];
- $i++;
- }
- $horda[$i]=1;
- $ali[$i]=1;
- $timestamps[$i] = 1;
- // Create the graph. These two calls are always required
- $graph = new Graph(1024,320,"auto");
- $graph->img->SetMargin(40,40,40,40);
- $graph->SetScale("textlin");
- $graph->SetShadow();
- // Create the linear plots for each category
- $dplot[] = new LinePLot($horda);
- $dplot[] = new LinePLot($ali);
- $dplot[0]->SetFillColor("red");
- $dplot[1]->SetFillColor("blue");
- // Create the accumulated graph
- $accplot = new AccLinePlot($dplot);
- // Add the plot to the graph
- $graph->Add($accplot);
- $graph->xaxis->SetTextTickInterval(360);
- $graph->xaxis->SetTickLabels($timestamps);
- $date = date("H:i:s");
- $graph->title->Set("5 hodinovy graf $jmeno_serveru");
- $graph->xaxis->title->Set($date);
- $graph->yaxis->title->Set("Online Players");
- $graph->title->SetFont(FF_FONT1,FS_BOLD);
- $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
- $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
- // Display the graph
- $graph->Stroke();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement