<?php
require_once ("jpgraph/jpgraph.php");
require_once ("jpgraph/jpgraph_bar.php");
function separator1000($aVal) {
return number_format($aVal);
}
function separator1000_usd($aVal) {
return '$'.number_format($aVal);
}
$datay=array(120567,134013,192000,87000);
$graph = new Graph(500,300,'auto');
$graph->img->SetMargin(80,30,30,40);
$graph->SetScale('textint');
$graph->SetShadow();
$graph->SetFrame(false);
$graph->yaxis->scale->SetGrace(50);
$graph->yaxis->SetLabelFormatCallback('separator1000');
$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetFont(FF_FONT2);
$graph->title->Set('Example of Y-scale callback formatting');
$graph->title->SetFont(FF_FONT2,FS_BOLD);
$graph->xaxis->title->Set('Year 2002');
$graph->xaxis->title->SetFont(FF_FONT2,FS_BOLD);
$bplot = new BarPlot($datay);
$bplot->SetFillColor('orange');
$bplot->SetWidth(0.5);
$bplot->SetShadow();
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
$bplot->value->SetAngle(45);
$bplot->value->SetFormatCallback('separator1000_usd');
$bplot->value->SetColor('black','darkred');
$graph->Add($bplot);
$graph->Stroke();
?> |