宝哥软件园

用php中的Jpgraph绘制柱形图的方法

编辑:宝哥软件园 来源:互联网 时间:2021-09-09

本文阐述了用php中的Jpgraph绘制柱形图的方法。分享给大家参考。具体实现方法如下:

?PHP include(' src/jpgraph . PHP ');包括(' src/jpgraph _ bar . PHP ');$data=array(19,23,34,38,45,67,71,78,85,87,90,96);//定义数组$graph=new Graph(400,300);//创建新的Graph对象$ Graph-SetScale(' text Lin ');$ graph-SetShadow();//设置shadow $ graph-img-设置边距(40,30,20,40);//设置保证金$barplot=新BarPlot($ data);//创建BarPlot对象$barplot-SetFillColor('蓝色');//设置颜色$ bar plot-value-Show();//设置显示编号$ graph-Add($ bar plot);//将柱形图添加到图像$graph-title-Set('年度收支表');//设置标题和X-Y轴标题$graph-xaxis-title-Set('月');$graph-yaxis-title-Set('总金额(百万美元)');$graph-title-SetFont(FF_SIMSUN,FS _ BOLD);//设置字体$ graph-yaxis-title-set font(ff _ simsun,fs _ bold);$ graph-xaxis-title-SetFont(FF _ SIMSUN,FS _ BOLD);$ graph-Stroke();运行效果如下图所示:

希望这篇文章对大家的php编程有所帮助。

更多资讯
游戏推荐
更多+