E书首页 - 下载 - 范文 - IT - 秘书 - 专家 - 创业 - 健康 - 百科 - 电影 - 娱乐 - 写真 - 英语 - 技术 - BBS - BLOG
IT资讯 | 业 界 | 互 联 网 | 通 信 | 人 物 | 数 码 | 软 件 | 硬 件 | 游 戏 | 技术百科 | 搜索引擎 | 操作系统
网络编程 | 网页设计 | 图形图像 | 网络媒体 | 网络安全 | 防 火 墙 | 站长必修 | 建站相关 | 数 据 库 | 服 务 器
游客登录 安全防范 NET专区 PHOTOSHOP专题 设为首页 加入收藏
您现在的位置: 中华E书网 >> IT学院 >> 网络编程 >> PHP专区 >> 正文
▎php做饼图的函数
php做饼图的函数
作者:佚名   文章来源:EBOOK-CN.COM   更新时间:2005-12-4 15:37:07
########
bimage.php3
########
/*
函数说明
$chartdata:数据,是数组元素
$chartfont:字号
$chartdiameter:决定饼的大小(要看你饿不饿了,呵呵)
$chartlabel:标题,也是数组元素
$colorslice:颜色数组,例如$tmp=array255,255,255);$colorslic=array($tmp);
$colorborder:边框颜色,数组
$colortext :文本颜色,数组
$colorbody:背景颜色,数组
$file:输出图片文件名*/
function bimage($chartdata,
$chartfont,
$chartdiameter ,
$chartlabel ,
$colorslice,
$colorbody ,
$colorborder,
$colortext ,
$file
)
{
$chartdiameter=150;

$chartfontheight=imagefontheight($chartfont);
$d1=10;$d2=20;$d3=30;$d4=40;$d5=50;
$chartdata=array($d1,$d2,$d3,$d4,$d5);
$chartlabel=array("D1","D2","D3","D4","D5");
$chartwidth=$chartdiameter+20;
$chartheight=$chartdiameter+20+(($chartfontheight+2)*count($chartdata));
header("content-type:image/gif");
$image=imagecreate($chartwidth,$chartheight);
$colorbody =imagecolorallocate ($image,$colorbody[0],$colorbody[1],$colorbody[2]);
$colortext =imagecolorallocate ($image,$colortext[0],$colortext[1],$colortext[2]);
$colorborder =imagecolorallocate ($image,$colorborder[0],$colorborder[1],$colorborder[2]);
for ($i=0;$i {
$t=imagecolorallocate($image,$colorslice[$i][0],$colorslice[$i][1],$colorslice[$i][2]);
$colorslice[$i]=$t;
}
for($i=0;$i {
$charttotal+=$chartdata[$i];
}
$chartcenterx=$chartdiameter/2+10;
$chartcentery

[1] [2] [3] [4] 下一页

  • 上一篇文章:

  • 下一篇文章:

  • 相关文章
    PHP中的DOM XML函数…
    Pattern Modifiers - 规则表达式的修饰符…
    PHP4实际应用经验篇(6)
    PHP4实际应用经验篇(5)
    PHP4实际应用经验篇(4)
    PHP4实际应用经验篇(3)
    PHP4实际应用经验篇(2)
    PHP4实际应用经验篇(1)
    Pattern Modifiers - 规则表达式的修饰符…
    正则表达式例子:将MM/DD/YYYY格式的日期转…
    正则表达式例子:在一个字符串中查找另一个…
    正则表达式例子:获得某个网页上的所有超裢…
    虚拟主机 | 数据恢复 | 操作系统
    网络游戏 | 液晶电视 | 数码相机
    电子商务 | 思科认证 | 系统集成
    防 火 墙 | 服 务 器 | 路 由 器
    ▎编辑推荐
    ▎最新热门
    ▎合作链接

    | 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 | |
    建议使用IE5.5以上版本浏览-感谢263数据中心 提供技术支持
    中华E书网 版权所有 本站通用网址:中华E书网
    沪ICP备05001118号