您好,欢迎访问一九零五行业门户网

php报表之jpgraph柱状图实例_PHP教程

jpgraph是php中一个非常非常强大的第三方报表工具,据说能完成一切你想要的图形…
新手初识jpgraph肯定会遇到各种各样的问题,比如乱码什么的,本案例是jpgraph3.0.7制作,也经过本人的多次实验,解决乱码问题
$value){
$datay[] = $value;
$datax[] = $userids[$key];
}
require_once (‘jpgraph-3.0.7/jpgraph/jpgraph.php’);
require_once (‘jpgraph-3.0.7/jpgraph/jpgraph_bar.php’);
// create the graph. these two calls are always required
$graph = new graph(800,600);    //图像高宽
$graph->setscale(“textlin”);
$graph->xaxis->setticklabels($datax);
$graph->xaxis->setfont(ff_verdana,fs_normal,10);
$graph->xaxis->setlabelangle(30);
$graph->yaxis->scale->setgrace(20);
$graph->xaxis->scale->setgrace(20);
// add a drop shadow
$graph->setshadow();
// adjust the margin a bit to make more room for titles
$graph->img->setmargin(40,30,20,40);
// create a bar pot
$bplot = new barplot($datay);
// adjust fill color
$bplot->setfillcolor(‘orange’);
$bplot->value->show();
$bplot->value->setfont(ff_arial,fs_bold,10);
$bplot->value->setangle(45);
$bplot->value->setformat(‘%d’);
$graph->add($bplot);
// setup the titles
$graph->title->set(iconv(“utf-8″, “gb2312″,”用户消费报表图”));
$graph->xaxis->title->set(iconv(“utf-8″, “gb2312″,”用户姓名”));
$graph->yaxis->title->set(iconv(“utf-8″, “gb2312″,”用户订单数量”));
$graph->xaxis->title->setfont(ff_simsun,fs_bold);
$graph->yaxis->title->setfont(ff_simsun,fs_bold);
$graph->title->setfont(ff_simsun,fs_bold);
// display the graph
$graph->stroke();
?>
效果图:
jpgraph下载地址:jpgraph-002d3.0.7.tar.gz
原文地址:http://www.52blogger.com/archives/539
http://www.bkjia.com/phpjc/364589.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/364589.htmltecharticlejpgraph是php中一个非常非常强大的第三方报表工具,据说能完成一切你想要的图形 新手初识jpgraph肯定会遇到各种各样的问题,比如乱码什么的...
其它类似信息

推荐信息