一 代码
<?php
require_once 'src/jpgraph.php'; //导入Jpgraph类库
require_once 'src/jpgraph_bar.php'; //导入Jpgraph类库的柱状图功能
$data = array(80, 73, 89, 85, 92, 75 ,85 ,65, 84, 79, 85, 98); //设置统计数据
$graph = new Graph(600, 300); //设置画布大小
$graph->SetScale('textlin'); //设置坐标刻度类型
$graph->SetShadow(); //设置画布阴影
$graph->img->SetMargin(40, 20, 20, 40); //设置统计图边距
$barplot = new BarPlot($data); //实例化BarPlat对象
$barplot->SetFillColor('blue'); //设置柱形图前景色
$barplot->value->Show();
$graph->Add($barplot);
$graph->title->Set('吉林省***科技有限公司年度收支'); //设置统计图标题
$graph->xaxis->title->Set('月份'); //设置X轴名称
$graph->yaxis->title->Set('总金额(万元)'); //设置y轴名称
$graph->title->SetFont(FF_SIMSUN, FS_BOLD); //设置标题字体
$graph->xaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置X轴字体
$graph->yaxis->title->SetFont(FF_SIMSUN,FS_BOLD); //设置Y轴字体
$graph->Stroke(); //输出图像
二 运行结果
![](https://i-blog.csdnimg.cn/blog_migrate/9aa6614c1cc7d1af2cfc1d37b4a93e6d.png)