php中怎样生成坐标图,急急,高分求 去看看php中画图的函数,应该就可以了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不就是个折线图吗?faq区中就有 <?session_start();header("Content-type: image/gif"); header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);$week_regs = $_SESSION['week_regs'];//纵坐标$week_days = $_SESSION['week_days'];//横坐标$size = count($week_regs);$max_regs = 0;for ($i=0;$i<$size;$i++){ if ($max_regs<$week_regs[$i]) { $max_regs=$week_regs[$i]; }}$im = imagecreate(530,400); //创建图象//分配颜色$black = imagecolorallocate($im, 0,0,0);$white = imagecolorallocate($im, 255,255,255);$gray = imagecolorallocate($im, 223,223,223);$red = imagecolorallocate($im,255,0,0);$green = imagecolorallocate($im,0,255,0);$blue = imagecolorallocate($im,0,0,255);$yellow = imagecolorallocate($im,241,236,186);$unit = ceil($max_regs/300);//每像素代表的单位//画出矩形并填充imagefilledrectangle($im,0,0,530,400,$yellow);imagefilledrectangle($im,50,50,500,350,$white);imagerectangle($im,0,0,529,399,$black);//画横向虚线及刻度$style = array ($gray,$gray,$gray,$white);$style2 = array ($gray,$white,$white,$white);imagesetstyle($im, $style);for ($i=50;$i<=350;$i=$i+20) { imageline($im,50,$i,500,$i,IMG_COLOR_STYLED); $strtmp=(350-$i)*$unit; imagestring($im,2,20,$i-10,$strtmp,$blue);}//输出文字注解$strtmp = "date";imagestring($im,8,250,380,$strtmp,$black);$strtmp = "new reg community numbers";imagestringup($im,5,2,300,$strtmp,$black);//定义横竖坐标单位for ($i=0;$i<count($week_regs);$i++){ $x_pos[] = $i*60+50;}//画纵坐标和日期for ($j=0;$j<count($week_regs);$j++){ $cdate=$week_days[$j]; imagestring($im,2,$x_pos[$j]-30,350,$cdate,$black); imagesetstyle($im, $style); imageline($im,$x_pos[$j],50,$x_pos[$j],350,IMG_COLOR_STYLED);}for ($j=0;$j<count($week_regs)-1;$j++){ imageline($im,$x_pos[$j],350-ceil($week_regs[$j]/$unit),$x_pos[$j+1],350-ceil($week_regs[$j+1]/$unit),$red);}//完成画图Imagegif($im); ImageDestroy($im); ?> http://hh.cc163.com/php/phpimagehowto/#zhexiantu 或者我的BLOG里也有一个。http://blog.csdn.net/kingerq http://www.aditus.nu/jpgraph/features.php下载这个库,使用方便功能强大,呵呵 如何输出URL里传来的变量$id如 tool.php?info=200@qq@帐号$id 求助 转换的问题!!! PHP正则替换页面链接 数据库被写入空值~~ 后台访问 急了!PHP服务器杂解析不了了呢? 求程序,关于PHP生成缩略图的程序 个人摸索的一些技巧,大家一起来写自己的心得啊 该如何写? mysql回行查询和建立复合索引的衡量? 需要熟手兼职,内附简介 请问如何在php页面中嵌入word控件?
session_start();
header("Content-type: image/gif");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
$week_regs = $_SESSION['week_regs'];//纵坐标
$week_days = $_SESSION['week_days'];//横坐标
$size = count($week_regs);
$max_regs = 0;
for ($i=0;$i<$size;$i++)
{
if ($max_regs<$week_regs[$i])
{
$max_regs=$week_regs[$i];
}
}
$im = imagecreate(530,400); //创建图象
//分配颜色
$black = imagecolorallocate($im, 0,0,0);
$white = imagecolorallocate($im, 255,255,255);
$gray = imagecolorallocate($im, 223,223,223);
$red = imagecolorallocate($im,255,0,0);
$green = imagecolorallocate($im,0,255,0);
$blue = imagecolorallocate($im,0,0,255);
$yellow = imagecolorallocate($im,241,236,186);
$unit = ceil($max_regs/300);//每像素代表的单位//画出矩形并填充
imagefilledrectangle($im,0,0,530,400,$yellow);
imagefilledrectangle($im,50,50,500,350,$white);
imagerectangle($im,0,0,529,399,$black);//画横向虚线及刻度
$style = array ($gray,$gray,$gray,$white);
$style2 = array ($gray,$white,$white,$white);
imagesetstyle($im, $style);
for ($i=50;$i<=350;$i=$i+20) {
imageline($im,50,$i,500,$i,IMG_COLOR_STYLED);
$strtmp=(350-$i)*$unit;
imagestring($im,2,20,$i-10,$strtmp,$blue);
}//输出文字注解
$strtmp = "date";
imagestring($im,8,250,380,$strtmp,$black);
$strtmp = "new reg community numbers";
imagestringup($im,5,2,300,$strtmp,$black);//定义横竖坐标单位for ($i=0;$i<count($week_regs);$i++)
{
$x_pos[] = $i*60+50;
}
//画纵坐标和日期
for ($j=0;$j<count($week_regs);$j++)
{
$cdate=$week_days[$j];
imagestring($im,2,$x_pos[$j]-30,350,$cdate,$black);
imagesetstyle($im, $style);
imageline($im,$x_pos[$j],50,$x_pos[$j],350,IMG_COLOR_STYLED);
}
for ($j=0;$j<count($week_regs)-1;$j++)
{
imageline($im,$x_pos[$j],350-ceil($week_regs[$j]/$unit),$x_pos[$j+1],350-ceil($week_regs[$j+1]/$unit),$red);
}
//完成画图
Imagegif($im);
ImageDestroy($im); ?>
http://blog.csdn.net/kingerq
下载这个库,使用方便功能强大,呵呵