<?php
include_once ("jpgraph/jpgraph.php");
include_once ("jpgraph/jpgraph_line.php");
$n = 5;
for($i=0; $i < $n; ++$i ) {
$targ1[$i] = "#$i";
$targ2[$i] = "#$i";
$targ3[$i] = "#$i";
$alts1[$i] = "val=%d";
$alts2[$i] = "val=%d";
$alts3[$i] = "val=%d";
}
$datay1 = array(3,10,4,1,6);
$datay2 = array(25,22,18,24,20);
$datay3 = array(89,70,92,77,96);
$graph = new Graph(500,250);
$graph->SetMargin(60,180,50,40);
$graph->SetMarginColor('white');
$graph->title->Set("Multi Y-axes with Image Map");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->SetScale("intlin");
$graph->SetYScale(0,'int');
$graph->SetYScale(1,'int');
$lp1 = new LinePlot($datay1);
$lp1->SetLegend('2001');
$lp1->mark->SetType(MARK_DIAMOND);
$lp1->mark->SetWidth(15);
$lp1->mark->SetFillColor('orange');
$lp1->SetCSIMTargets($targ1,$alts1);
$graph->yaxis->title->Set('Basic Rate');
$graph->yaxis->title->SetFont(FF_ARIAL,FS_BOLD,10);
$graph->yaxis->title->SetColor('black');
$graph->Add($lp1);
$lp2 = new LinePlot($datay2);
$lp2->SetLegend('2002');
$lp2->mark->SetType(MARK_DIAMOND);
$lp2->mark->SetWidth(15);
$lp2->mark->SetFillColor('darkred');
$lp2->SetCSIMTargets($targ2,$alts2);
$graph->ynaxis[0]->SetColor('darkred');
$graph->ynaxis[0]->title->Set('Rate A');
$graph->ynaxis[0]->title->SetFont(FF_ARIAL,FS_BOLD,10);
$graph->ynaxis[0]->title->SetColor('darkred');
$graph->AddY(0,$lp2);
$lp3 = new LinePlot($datay3);
$lp3->SetLegend('2003');
$lp3->mark->SetType(MARK_DIAMOND);
$lp3->mark->SetWidth(15);
$lp3->mark->SetFillColor('darkgreen');
$lp3->SetCSIMTargets($targ3,$alts3);
$graph->ynaxis[1]->SetColor('darkgreen');
$graph->ynaxis[1]->title->Set('Rate B');
$graph->ynaxis[1]->title->SetFont(FF_ARIAL,FS_BOLD,10);
$graph->ynaxis[1]->title->SetColor('darkgreen');
$graph->AddY(1,$lp3);
$graph->StrokeCSIM();
?> |