时间:2021-07-01 10:21:17 帮助过:16人阅读
require_once ('SqlHelper.class.php');//这是我写的类,用于操作数据库,但是一引入就出错
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_bar.php');
$datay1=array(12,12,15);
$datay2=array(0,0,0);
// Create the graph.
$graph = new Graph(350,250);
$graph->SetScale('textlin');
$graph->SetMarginColor('silver');
// Setup title
$str="";
$id=$_REQUEST['id'];
if($id==1){
$str="支持布什的情况统计图";
}else if($id==2) {
$str="支持奥巴马的情况统计图";
}
$graph->title->Set($str);
$graph->title->setFont(FF_SIMSUN,FS_BOLD,14);
// Create the first bar
$bplot = new BarPlot($datay1);
$bplot->SetFillGradient('AntiqueWhite2','AntiqueWhite4:0.8',GRAD_VERT);
$bplot->SetColor('darkred');
// Create the second bar
$bplot2 = new BarPlot($datay2);
$bplot2->SetFillGradient('olivedrab1','olivedrab4',GRAD_VERT);
$bplot2->SetColor('darkgreen');
// And join them in an accumulated bar
$accbplot = new AccBarPlot(array($bplot,$bplot2));
$graph->Add($accbplot);
$graph->Stroke();
?>