Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php // content="text/plain; charset=utf-8"
- require_once ('jpgraph/jpgraph.php');
- require_once ('jpgraph/jpgraph_line.php');
- require_once ('getstat.php');
- doInclude();
- $title = $_GET['title'];
- $minutes = $_GET['minutes'];
- $axis = $_GET['naxis'];
- $data = array();
- $labels = array();
- for($i=0;$i<$axis;$i++){
- $data[$i] = getStat($_GET['axisname'.$i], $minutes);
- $labels[$i] = $_GET['axislabel'.$i];
- }
- // Setup the graph
- $graph = new Graph(400,350);
- $graph->SetScale("textlin");
- $theme_class=new UniversalTheme;
- $graph->SetTheme($theme_class);
- $graph->img->SetAntiAliasing(false);
- $graph->title->Set($title);
- $graph->SetBox(false);
- $graph->img->SetAntiAliasing();
- $graph->yaxis->HideZeroLabel();
- $graph->yaxis->HideLine(false);
- $graph->yaxis->HideTicks(false,false);
- $graph->xgrid->Show();
- $graph->xgrid->SetLineStyle("solid");
- $graph->xaxis->HideLabels();
- $graph->xgrid->SetColor('#E3E3E3');
- for($i=0;$i<count($data);$i++){
- $p = new LinePlot($data[$i]);
- $graph->Add($p);
- $p->SetColor(col($i));
- $p->SetLegend($labels[$i]);
- }
- $graph->legend->SetFrameWeight(1);
- // Output line
- $graph->Stroke();
- function col($index){
- if($index == 0){
- return "#6495ED";
- }else if($index == 1){
- return "#B22222";
- }else if($index == 2){
- return "#FF1493";
- }else{
- return "#FF1493";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment