<?php
include ("../jpgraph.php"); //包含jpgraph主文件
include ("../jpgraph_bar.php"); //包含柱状图文件
//x轴和y轴的数据,以数组形式赋值
$datax = array("01","02","03","04","05","06","07","08","09","10");
$data1y=array(20,8,19,3,10,5,7,11,10,3);
$data2y=array(8,2,11,7,14,4,15,3,7,21);
$data3y=array(28,10,30,10,24,9,22,14,17,24);
//创建Graph类,500为宽度,300为高度
$graph = new Graph(500,300,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(40,30,20,50);
$graph->xaxis->SetTickLabels($datax);// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetFillColor("orange");
$b1plot->SetLegend("加盟数");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("blue");
$b2plot->SetLegend("一般数");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillColor("red");
$b3plot->SetLegend("总数");
// Create the grouped bar plot
$gbplot = new GroupBarPlot(array($b1plot,$b2plot,$b3plot));
// ...and add it to the graPH
$graph->Add($gbplot);
$title = "按天统计 (2007年6月)";
$graph->title->Set($title);
$graph->xaxis->title->Set("日期");
$graph->yaxis->title->Set("数据量");
$graph->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD);
$graph->legend->SetFont(FF_SIMSUN,FS_BOLD);
// Display the graph
$graph->Stroke();
?>


