国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

如何用php作線形圖的函數

2024-05-04 23:01:52
字體:
來源:轉載
供稿:網友
很高興大家對php如此的情有獨鐘!
下面就給大家介紹php作線形圖的函數:

/*
函數說明
$data:y軸數據(數組)
$graphdata:y軸數據--百分比(數組)
$label:x軸數據(數組)
$height:圖像高度
$width:圖像寬度
$font:字號
$dot:決定點的大小
$bg:背景色
$line :線色
$text :文本色
$dotcolor:點色
$file:輸出圖像文件名
*/

function qximage($data ,
$graphdata,
$label ,
$height,
$width ,
$font,
$dot,
$bg,
$line,
$text,
$dotcolor,
$file)
{
$jc=$height/100;
$fontwidth= imagefontwidth ($font);
$fontheight=imagefontheight($font);

$image= imagecreate ($width,$height+20);
$bg= imagecolorallocate($image ,$bg[0],$bg[1],$bg[2]);
$line=imagecolorallocate($image ,$line[0],$line[1],$line[2]);
$text=imagecolorallocate($image ,$text[0],$text[1],$text[2]);
$dotcolor=imagecolorallocate($image ,$dotcolor[0],$dotcolor[1],$$dotcolor[2]);
imageline ($image,0,0,0,$height,$line);
imageline($image,0,$height,$width,$height,$line);
for ($i=1;$i<11;$i++)
{
imagedashedline($image,0,$height - $jc*$i*10 ,$width ,$height -$jc*$i*10 ,$line );
imagestring ($image,$font,0,$height-$jc*$i*10,$i*10,$text);
}
for ($i=0;$i {
#echo $tmp."
";
$x1=(($width-50)/count($data))*($i)+40;
#echo $x1 ."
";
$y1=$height-$graphdata[$i]*$jc;
$x2=$x1;
$y2=$y1+$graphdata[$i]*$jc;
#echo $y1."
";
imagestring($image,$font,$x1,$y1-2*$fontheight,$graphdata[$i]."%(".$data[$i].")",$text);
imagearc ($image,$x1 ,$y1,$dot,$dot,0,360,$dotcolor);
imagefilltoborder ($image,$x1,$y1,$dotcolor,$dotcolor);
imagestring ($image,$font,$x1,$y2,$label[$i],$text);
if ($i>0)
{
imageline($image,$tmpx1,$tmpy1,$x1,$y1,$line);
}
$tmpx1=$x1;$tmpy1=$y1;
}
imagegif ($image,$file);
}
?>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 重庆市| 靖安县| 屏东市| 将乐县| 中江县| 小金县| 门源| 曲周县| 桂平市| 正镶白旗| 定西市| 连山| 固始县| 龙游县| 根河市| 诸暨市| 兰坪| 信宜市| 诸城市| 慈利县| 荣成市| 尼勒克县| 贵阳市| 双流县| 文登市| 常德市| 昂仁县| 怀仁县| 吉林省| 获嘉县| 宜良县| 瑞金市| 宁波市| 吉木乃县| 晋城| 锦屏县| 清镇市| 布拖县| 忻州市| 长治县| 隆林|