去看看php中画图的函数,应该就可以了

解决方案 »

  1.   

    不就是个折线图吗?faq区中就有
      

  2.   

    <?
    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); ?>
      

  3.   

    http://hh.cc163.com/php/phpimagehowto/#zhexiantu
      

  4.   

    或者我的BLOG里也有一个。
    http://blog.csdn.net/kingerq
      

  5.   

    http://www.aditus.nu/jpgraph/features.php
    下载这个库,使用方便功能强大,呵呵