<?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
define('DATAPERMONTH',40);
$m=$gDateLocale->GetShortMonth();
$k=0;
for($i=0; $i < 480; ++$i) {
$datay[$i] = rand(1,40);
if( $i % DATAPERMONTH === 0 )
$months[$i] = $m[(int)($i/DATAPERMONTH)];
else
$months[$i] = 'xx';
}
$graph = new Graph(400,200);
$graph->SetScale('textlin');
$graph->xaxis->SetTickLabels($months);
$graph->xaxis->SetTextTickInterval(DATAPERMONTH,0);
$graph->xaxis->SetTextLabelInterval(2);
$graph->title->Set('Textscale with tickinterval=2');
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetBox(true,'red');
$lp1 = new LinePlot($datay);
$lp1->SetLegend('Temperature');
$graph->Add($lp1);
$graph->Stroke();
?> |