仓酷云

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1726|回复: 18
打印 上一主题 下一主题

[学习教程] PHP网站制作之若何用php作线形图的函数

[复制链接]
山那边是海 该用户已被删除
跳转到指定楼层
楼主
发表于 2015-2-4 00:04:38 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
也得学会了PHP。然后再学,见异思迁是最不可取的,狗熊掰玉米就是这个道理,如果经常中途放弃,只能是一无所获,还浪费了N多的时间和经历,得不偿失,最重要的是,你会被别人瞧不起。   很乐意人人对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);
}
?>

学校并没有那么多的时间可以让我们在实际开发上面。
山那边是海 该用户已被删除
沙发
 楼主| 发表于 2015-3-7 13:51:08 | 显示全部楼层
微软最近出的新字体“微软雅黑”,虽然是挺漂亮的,不过firefox  支持的不是很好,所以能少用还是少用的好。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|仓酷云 鄂ICP备14007578号-2

GMT+8, 2024-5-15 16:58

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表