可以用3,按table宽度的%比来设置背景色

解决方案 »

  1.   

    用gd最简单,但生成的图片可能较大。修改起来略嫌麻烦
    要求不高时建议用table,3张图片“ o-”、“---”、“-> ”文字也可
      

  2.   

    table --具体函数什么样啊 ?
      

  3.   

    楼上的,table是表格啊,不是什么函数
      

  4.   


    其实做直线图用table最简单了,也很美观,看起来跟图片一模一样,只要不包括曲线就可以做出很复杂的图了
      

  5.   

    <?
    $i=1;
    echo"<table border=0 width=100% bgcolor=#FFFFFF cellspacing=0 cellpadding=0>";
    while($i<32)
    {

    echo "<td  style='border:0px #C0C0C0 solid'>$i</td>";
    $i++;}function table_entry($s,$e)
     
    {  
            $color=$e-$s;
    if ($s=="") $s=0;
    if ($s>100) $s=100;
    if ( $e!=0)
    {   
                $ret.="<tr><td colspan=31 height=20></td></tr>";
    $ret.="<tr><td colspan=$s   style='border:0px #C0C0C0 solid' height=2><div align=left>";
    $ret.="<table border=0  bgcolor=ffffff height=1 cellspacing=0 cellpadding=0><tr></table>";
    $ret.="<td colspan=$color  bgcolor=ff0000 height=2><table border=0  bgcolor=0000CC height=2 cellspacing=0 cellpadding=0></table></td></tr>";
    }

    else
    {
    $ret="<tr><td   width=100%  colspan=31 style='border:0px #C0C0C0 solid' height=2><div align=left>";
    $ret.="<table border=1 width=100% bgcolor=#FFFFFF height=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table>";
    }

    //$ret.="</div></td></tr></table></td></tr></center></table>";
    return $ret;}echo table_entry($s,$e);
    $s=20;
    $e=30;
    echo table_entry($s,$e);
    $s=10;
    $e=20;
    echo table_entry($s,$e);
    $s=5;
    $e=25;
    echo table_entry($s,$e);?>
    ////////////////////////////////////////////////////////////////////////////
    这是方案3,希望对和我一样的初学者有帮助(不过被头淘汰了)