文章导航PC6首页软件下载单机游戏安卓资源苹果资源

pc软件新闻网络操作系统办公工具编程服务器软件评测

安卓新闻资讯应用教程刷机教程安卓游戏攻略tv资讯深度阅读综合安卓评测

苹果ios资讯苹果手机越狱备份教程美化教程ios软件教程mac教程

单机游戏角色扮演即时战略动作射击棋牌游戏体育竞技模拟经营其它游戏游戏工具

网游cf活动dnf活动lol周免英雄lol礼包

手游最新动态手游评测手游活动新游预告手游问答

您的位置:首页网页设计PHP实例 → 如何用php作线形图的函数

如何用php作线形图的函数

时间:2004/11/7 3:22:00来源:本站整理作者:蓝点我要评论(0)

很高兴大家对PHP如此的情有独钟!

下面就给大家介绍php作线形图的函数:



/*

函数说明

$data:y轴数据(数组)

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

$label:x轴数据(数组)

$height:图像高度

$width:图像宽度

$font:字号

$dot:决定点的大小

$bg:背景色

$line :线色

$text :文本色

$dotcolor:点色

$file:输出图像文件名

*/



function qximage($data ,

$graphdata,

$label ,

$height,

$width ,

$font,

$dot,

$bg,

$line,

$text,

$dotcolor,

$file)

{

$jc=$height/100;

$fontwidth= imagefontwidth ($font);

$fontheight=imagefontheight($font);



$image= imagecreate ($width,$height+20);

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

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

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

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

imageline ($image,0,0,0,$height,$line);

imageline($image,0,$height,$width,$height,$line);

for ($i=1;$i<11;$i++)

{

imagedashedline($image,0,$height - $jc*$i*10 ,$width ,$height -$jc*$i*10 ,$line );

imagestring ($image,$font,0,$height-$jc*$i*10,$i*10,$text);

}

for ($i=0;$i {

#echo $tmp."

";

$x1=(($width-50)/count($data))*($i)+40;

#echo $x1 ."

";

$y1=$height-$graphdata[$i]*$jc;

$x2=$x1;

$y2=$y1+$graphdata[$i]*$jc;

#echo $y1."

";

imagestring($image,$font,$x1,$y1-2*$fontheight,$graphdata[$i]."%(".$data[$i].")",$text);

imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor);

imagefilltoborder ($image,$x1,$y1,$dotcolor,$dotcolor);

imagestring ($image,$font,$x1,$y2,$label[$i],$text);

if ($i>0)

{

imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line);

}

$tmpx1=$x1;$tmpy1=$y1;

}

imagegif ($image,$file);

}

?>





【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】    


相关阅读 Windows错误代码大全 Windows错误代码查询激活windows有什么用Mac QQ和Windows QQ聊天记录怎么合并 Mac QQ和Windows QQ聊天记录Windows 10自动更新怎么关闭 如何关闭Windows 10自动更新windows 10 rs4快速预览版17017下载错误问题Win10秋季创意者更新16291更新了什么 win10 16291更新内容windows10秋季创意者更新时间 windows10秋季创意者更新内容kb3150513补丁更新了什么 Windows 10补丁kb3150513是什么

文章评论
发表评论

热门文章 没有查询到任何记录。

最新文章 我的php文件怎么打开_php运算符怎么写 php 如何生成静态页面的函数PHP生成图片缩略图PHP session常见问题集锦及解决办法PHP实现同步远程Mysql

人气排行 DEDE在文章列表文章没有缩略图的不显示图片php+mysq修改用户密码我的php文件怎么打开_如何打开php文件的办法FCKeditor的配置和使用方法使用dedecms建站教程PHP+Ajax实现分页技术图片存储与浏览一例Linux+Apache+PHP+MySQLPHP生成图片缩略图