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下载这个库,使用方便功能强大,呵呵 php项目中要从用户上传的swf文件中截取一张图片,请问如何做到 if(-f aa.txt) then 什么意思 如何实现php执行linux系统命令,比如修改xwindow分辨率,并在系统中立即显示效果 一数据库问题 请高手帮我看一下啊 后台HTML 代码不完整, 前台错位 PHP中有类似于asp中的Server.Htmlencode的内置函数吗? 请教PHP可以调用DELPHI写的动态库吗? 菜鸟求教,如何在liuxe系统下新建个文件或文件(如123.dat)!! 索引(index)和键名(key)有什么不同? 需要熟手兼职,内附简介 请问如何在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
下载这个库,使用方便功能强大,呵呵