<?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
require_once ('jpgraph/jpgraph_date.php');
DEFINE('NDATAPOINTS',360);
DEFINE('SAMPLERATE',240);
$start = time();
$end = $start+NDATAPOINTS*SAMPLERATE;
$data = array();
$xdata = array();
for( $i=0; $i < NDATAPOINTS; ++$i ) {
$data[$i] = rand(50,70);
$xdata[$i] = $start + $i * SAMPLERATE;
}
$graph = new Graph(540,300);
$graph->SetMargin(40,40,30,130);
$graph->SetScale('datlin',0,100);
$graph->title->Set("Example on Date scale");
$graph->xaxis->SetLabelAngle(90);
$graph->xaxis->scale->SetDateFormat('H:i');
$graph->xaxis->scale->SetTimeAlign(MINADJ_10);
$line = new LinePlot($data,$xdata);
$line->SetLegend('Year 2005');
$line->SetFillColor('lightblue@0.5');
$graph->Add($line);
$graph->Stroke();
?> |