<?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$datay=array(2,3,5,8,12,6,3);
$datax=array('Jan','Feb','Mar','Apr','May','Jun','Jul');
$width=400;
$height=500;
$graph = new Graph($width,$height,'auto');
$graph->SetScale('textlin');
$graph->Set90AndMargin(50,20,50,30);
$graph->SetShadow();
$graph->title->Set('Horizontal bar graph ex 1');
$graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_VERDANA,FS_NORMAL,12);
$graph->xaxis->SetLabelMargin(10);
$graph->xaxis->SetLabelAlign('right','center');
$graph->yaxis->scale->SetGrace(20);
$graph->yaxis->Hide();
$bplot = new BarPlot($datay);
$bplot->SetFillColor('orange');
$bplot->SetShadow();
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,12);
$bplot->value->SetAlign('left','center');
$bplot->value->SetColor('black','darkred');
$bplot->value->SetFormat('%.1f mkr');
$graph->Add($bplot);
$graph->Stroke();
?> |