php做柱型图的函数

#为了方便起见我又做了一个函数来制作柱型图

/*参数说明:

$graphdata:百分比数据(y轴)

$label:x轴标题

$data:实际数据(y轴)

$graphwidth:图像宽度

$graphheight:图像高度

$graphscale:高度因子(为$graphheight/100)

$graphfont:字体号

$bg;背景颜色值

$text:文本颜色值

$grid:边线颜色值

$bar:柱的颜色值

$bz:备注(不支持中文呀)

*/


<?

function timage(

$graphdata
,$label,$data,

$graphwidth
,$graphheight,$graphscale,$graphfont,

$bg
,$text,$grid,$bar,$bz)

{



header
("Content-type:image/gif");

$image
=imagecreate($graphwidth+50,$graphheight+50);

$bgcolor
= imagecolorallocate ($image ,$bg[0],$bg[1],$bg[2]);

$textcolor
= imagecolorallocate ($image ,$text[0],$text[1],$text[2]);

$gridcolor
=imagecolorallocate ($image ,$grid[0],$grid[1],$grid[2]);

$barcolor
=imagecolorallocate ($image ,$bar[0],$bar[1],$bar[2]);

$gridabelwidth
=imagefontwidth($graphfont)*3+1;

$gridableheight
= imagefontheight ($graphfont);

imageline
($image,$gridlabelwidth,0,$gridlabelwidth,$graphheight-1,$gridcolor); 数据挖掘工具

imageline
($image,0,$graphheight-1,$graphwidth-1,$graphheight-1,$gridcolor);

for($i=0;$i<$graphheight;$i+=$graphheight/10) 数据挖掘工具

{

imagedashedline
($image,0,$i,$graphwidth-1,$i,$gridcolor);

imagestring
($image,$graphfont,0,$i,round(($graphheight-$i)/$graphscale),$textcolor); 数据挖掘工具

}



$barwidth
=(($graphwidth-$gridlabelwidth)/count($graphdata))-30;#&iquest;&Oslash;&Ouml;&AElig;&Ouml;ù&micro;&Auml;×&Uuml;&iquest;í&para;&Egrave; 数据挖掘工具

for($i=0;$i<count($graphdata);$i++)

{

$bartopx
=$gridlabelwidth+(($i+1)*20)+($i*$barwidth);#&iquest;&Oslash;&Ouml;&AElig;&Ouml;ù&iquest;&iquest;×ó&micro;&Auml;&frac34;à&Agrave;&euml; 数据挖掘交友

$barbottomx
=$bartopx+$barwidth;

$barbottomy
=$graphheight-1;#&iquest;&Oslash;&Ouml;&AElig;&Ouml;ù&micro;&Auml;&Iuml;&Acirc;±&szlig;&frac12;&ccedil;

数据挖掘交友



$bartopy
=$barbottomy-($graphdata[$i]*$graphscale);

imagefilledrectangle
($image,$bartopx,$bartopy,$barbottomx,$barbottomy,$barcolor);

$labelx1
=$bartopx; 数据挖掘论坛

$labely1
=$bartopy-15;

$labelx2
=$bartopx;

$labely2
=$graphheight;

imagestring
($image,$graphfont,$labelx1,$labely1,"$graphdata[$i]"."%",$textcolor);

imagestring
($image,$graphfont,$labelx2,$labely2,"$label[$i]",$textcolor);

imagestringup
($image,$graphfont,$labelx1+10,$labely1-$gridableheight,"$data[$i]",$textcolor);

}

imagestring
($image,$graphfont,1,$graphheight+30,$bz,$textcolor);

imagegif
($image);



}

?>
[数据挖掘工作交流] [数据挖掘研究院] [数据挖掘论坛] [数据挖掘实验室]
上一篇:修改Zend引擎实现PHP源码加密的原理及实践
下一篇:介绍几个windows下的COM相关函数
最新评论共有 0 位网友发表了评论 , 查看所有评论
发表评论( 不能超过250字,需审核,请自觉遵守互联网相关政策法规。 )
匿名?
数据挖掘网站导航 数据挖掘论坛导航
  • 数据挖掘工具
  • 数据挖掘论坛
  • DataCruncher - Cognos
  • MineSet - MathSoft
  • Intelligent Miner - GainSmarts
  • Sqlserver - SAS - Clementine
  • CART - Weka - WizSoft
  • NeuroShell - ModelQuest
  • data mining tools - Darwin
  • 数据挖掘交友
  • 数据挖掘博客
  • 数据挖掘工具
  • 数据挖掘资源
  • 数据挖掘技术算法
  • 数据挖掘相关期刊、会议
  • 研究院联盟合作专区
  • 数据挖掘基础与相关技术
  • 数据挖掘厂商与就业
  • 数据挖掘研究者乐园
  • 知名厂商数据挖掘工具资料
  • 国内数据挖掘实验室
  • Foreign Data Mining Lab
  • 热点关注
  • 揭秘成为最牛程序员的五大要诀
  • MYSQL错误:Illegal mix of collations (lat
  • PHP程序不适用大型系统的九大原因
  • 上海酒店公寓,上海短租公寓,上海短租房,上
  • 安装php5.2.5和mysql5.045后phpmyadmin报错
  • 福利彩票幸运号码自动生成器
  • 关于APACHE的配置文件httpd.conf
  • 国际:身处两难境地,PHP 该走向何方?
  • PHP跳转的方法?
  • 函式:preg_match_all()
  • 论坛最新话题
  • 正规省级、国家级别期刊征集论文稿件
  • 寻data mining cookbook 一书的配套光盘
  • 网博垂直搜索引擎完全开源版
  • 电脑也会成为火灾元凶 操作不当也会有危险
  • 网络暴力间接逼死崔真实 韩国拟立法实名上
  • 网络最流行的歌曲单良《那一场雪》推荐给大
  • 快国庆了大家怎么安排
  • 08年“铁观音秋茶”安溪铁观音,茶叶批发网
  • 快国庆了大家怎么安排
  • 世界最大规模“网格计算”网络启动
  • 相关资讯
  • Module mod_log_config
  • 圣殿骑兵PHP 2007年Web开发技术预言 (四)
  • 圣殿骑兵PHP 2007年Web开发技术预言 (三)
  • 圣殿骑兵PHP 2007年Web开发技术预言 (二)
  • 圣殿骑兵PHP 2007年Web开发技术预言 (一)
  • 一棵php的类树(支持无限分类)
  • 通过对php一些服务器端特性的配置加强php的
  • 如何使用动态共享对象的模式来安装PHP
  • 提升PHP执行速度全攻略(上)
  • phpBBBBcode处理的漏洞
  • 数据挖掘实验室资料
  • 注册成为SAS用户与爱好者俱乐部会员
  • 水南梅
  • 明日烟
  • 新人报道
  • 下载
  • 厦门服务器托管,450元/月—0592-5177319 高
  • 买空间送域名--0592-5177319 高静
  • mit ocw 数据挖掘相关课程连接
  • Introduction to Data Mining
  • Data Mining & Business Intelligence