1. [代码][php]代码 <?php
// header("content-type: image/jpg");
error_reporting(e_all ^ e_notice);
include ("jpgraph/jpgraph.php");
include ("jpgraph/jpgraph_bar.php");
$data2y=array(10,10,10,15,10,10);
$graph = new graph(600,300,"auto"); //创建画布
$graph->setscale('textlin',0,60); // 设置y轴的值 这里是0到60
//$graph->setscale("textlin");
// $graph->yaxis->scale->setgrace(0,60);
//创建画布阴影
$graph->setshadow();
$graph->img->setmargin(40,30,30,40);//设置显示区左、右、上、下距边线的距离,单位为像素
$bplot = new barplot($data2y);//创建一个矩形的对象
$bplot->setfillcolor('red'); //设置柱形图的颜色
$bplot->value->show();//设置显示数字
$bplot->value->setformat('%d');//在柱形图中显示格式化的评选结果
$graph->add($bplot);//将柱形图添加到图像中
$graph->setmargincolor("lightblue");//设置画布背景色为淡蓝色
$graph->title->set("评选结果");//创建标题
$vote_content=array('巴西','阿根廷','法国','瑞士','厄瓜多尔','德国');
$graph->xaxis->setticklabels($vote_content); //设置x坐标轴文字
$graph->title->setfont(ff_simsun);//设置字体
$graph->xaxis->setfont(ff_simsun); //设置字体
// $graph->stroke();//输出矩形图表
$graph->stroke();
?>
2. [图片] test.php.png