欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  php教程

thinkphp 3.2.2整合Jpgraph插件

程序员文章站 2022-06-14 22:47:38
...
thinkphp 3.2.2整合Jpgraph插件
thinkphp 3.2.2整合Jpgraph插件。
1、首先在Jpgraph官网下载一个Jpgraph插件包。
2、把Jpgraph插件包复制到Thinkphp/Library/Vendor/Jpgraph文件夹下(小编习惯把插件放到Thinkphp扩展文件夹里) //画图案例
public function draw3D(){
vendor('Jpgraph.Chart');
$chart = new \Chart;

$title = '3D饼图'; //标题
$data = array(20,27,45,75,90,10,20,40); //数据
$size = 140; //尺寸
$width = 800; //宽度
$height = 500; //高度
$legend = array('aaaa ','bbbb','cccc','dddd ','eeee ','ffff ','gggg ','hhhh ');//说明
// $chart->create3dpie($title,$data,$size,$height,$width,$legend);

$title = '柱状图'; //标题
$data = array(20,27,45,75,90,10,80,100); //数据
$size = 140; //尺寸
$width = 750; //宽度
$height = 350; //高度
$legend = array('aaaa ','bbbb','cccc','dddd ','eeee ','ffff ','gggg ','hhhh ');//说明
$chart->createcolumnar($title,$data,$size,$height,$width,$legend);

/* $title = '柱状图'; //标题
$data = array(20,27,45,75,90,10,80,100); //数据
$size = 140; //尺寸
$width = 750; //宽度
$height = 350; //高度
$legend = array('aaaa ','bbbb','cccc','dddd ','eeee ','ffff ','gggg ','hhhh ');//说明
$chart->createmonthline($title,$data,$size,$height,$width,$legend);*/

/* $title = '柱状图'; //标题
$data = array(20,27,45,75,90,10,80,100); //数据
$size = 140; //尺寸
$width = 750; //宽度
$height = 350; //高度
$legend = array('aaaa ','bbbb','cccc','dddd ','eeee ','ffff ','gggg ','hhhh ');//说明
$chart->createring($title,$data,$size,$height,$width,$legend);

$title = '柱商务图'; //标题
$subtitle = '2012 年6月';
$data = array(20,27,45,75,90,100,80,100,300,500,1000,200,300,100,400,600); //数据
$size = 140; //尺寸
$width = 750; //宽度
$height = 350; //高度
$legend = array('张三1','张三2','张三3','张三4','张三5','张三6','张三7','张三8');//说明
$chart->createhorizoncolumnar($title,$subtitle,$data,$size,$height,$width,$legend);
*/
}
详细的整合方法请查看http://www.jb100.net/html/content-28-163-1.html

AD:真正免费,域名+虚机+企业邮箱=0元