<?php //JPGRAPH 生成柱形图 require_once("jpgraph/jpgraph.php"); require_once("jpgraph/jpgraph_bar.php"); $arrData = array(19, 23, 34, 136, 50, 65, 70, 178);//模拟数据 $graph = new Graph(400, 300); $graph->SetScale("textlin");//设置刻度模式 $graph->SetShadow();//设置阴影 $graph->img->SetMargin(50, 30, 30, 40);//设置边距 $barplot = new BarPlot($arrData); $barplot->SetFillColor('yellow'); //设置颜色 $barplot->value->Show(); //设置显示数字 $graph->Add($barplot);//将柱形图添加到图像中 //设置标题和X-Y轴标题 $graph->title->Set('第一个柱形图'); $graph->yaxis->title->Set("总资金(万元)"); $graph->xaxis->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->Stroke(); ?>