<?php
require_once('jpgraph/jpgraph.php');
require_once('jpgraph/jpgraph_line.php');
require_once('jpgraph/jpgraph_utils.inc.php');
require_once('dataset01.inc.php');
$dateUtils = new DateScaleUtils();
$width=500; $height=300;
$graph = new Graph($width, $height);
$graph->SetScale('intlin',0,0,min($xdata),max($xdata));
$graph->SetMargin(60,20,40,60);
$graph->title->SetFont(FF_ARIAL,FS_BOLD,12);
$graph->title->Set('Development since 1984');
$graph->subtitle->SetFont(FF_ARIAL,FS_ITALIC,10);
$graph->subtitle->Set('(Example using DateScaleUtils class)');
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetLabelAngle(30);
$graph->xaxis->SetLabelFormatString('M, Y',true);
list($tickPos,$minTickPos) = $dateUtils->getTicks($xdata,DSUTILS_YEAR2);
$graph->xaxis->SetTickPositions($tickPos,$minTickPos);
$lp1 = new LinePlot($ydata,$xdata);
$lp1->SetWeight(0);
$lp1->SetFillColor('orange@0.85');
$graph->Add($lp1);
$lp2 = new LinePlot($ydata,$xdata);
$lp2->SetColor('orange');
$graph->Add($lp2);
$graph->Stroke();
?> |