pChart图表插件使用
2015-08-18 10:45
731 查看
<?php /* 柱形图 */ #引入库文件 include("../class/pData.class.php"); include("../class/pDraw.class.php"); include("../class/pImage.class.php"); #创建数据对象 $MyData = new pData(); $MyData->addPoints(array(150,220,300,-250,-420,-200,300,200,100),"Server A"); $MyData->addPoints(array(140,0,340,-300,-320,-300,200,100,50),"Server B"); $MyData->setAxisName(0,"Hits"); $MyData->addPoints(array("January","February","March","April","May","Juin","July","August","September"),"Months"); $MyData->setSerieDescription("Months","Month"); $MyData->setAbscissa("Months"); #创建图形对象 $myPicture = new pImage(700,230,$MyData); #关闭平滑模式 $myPicture->Antialias = FALSE; #增加边框 $myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100)); $myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20)); $myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0)); #设置默认字体 $myPicture->setFontProperties(array("FontName"=>"../fonts/pf_arma_five.ttf","FontSize"=>6)); #定义图像区域 $myPicture->setGraphArea(60,40,650,200); #设置比例 $scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE); $myPicture->drawScale($scaleSettings); #设置图例 $myPicture->drawLegend(580,12,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL)); #设置阴影 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); #画图表 $myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10)); $settings = array("Surrounding"=>-30,"InnerSurrounding"=>30); $myPicture->drawBarChart($settings); #递交图片 $myPicture->autoOutput("pictures/example.drawBarChart.simple.png"); ?>
相关文章推荐
- HTML5新标签
- 如何把word与pdf等文档格式进行转换
- lvs 的 hash table
- 【读书札记】《北大授课》中华文化四十七讲 余秋雨
- 我只是不擅长处理爱情,可是我可以努力
- hd-2544:最短路 dijkstra
- Apache Maven 入门篇(下)
- 极限优化:php巧用tcp长连接
- 最新版IOCP_API来袭,你准备好了吗?
- smarty模板
- Network Saboteur(POJ--2531
- 前小米产品经理在腾讯工作一年的工作总结!
- android的TouchEvent事件机制
- Android Led驱动[Linux Led子系统]
- UE4 Texture Guidelines for Mobile Platforms
- MyEclipse10用方法句柄出错
- 数组溢出 Array out of bounds
- 注释所有调试代码的方法
- HDU 2203 亲串(kmp)
- java-正则表达式过滤字符串中的html标签