欧美特黄不卡,涩涩视频在线,成人国产精品一区二区网站,亚洲一区二区三区欧美

當前位置:雨林木風下載站 > 技術開發教程 > 詳細頁面

如何用php作線形圖的函數

如何用php作線形圖的函數

更新時間:2022-04-27 文章作者:未知 信息來源:網絡 閱讀次數:

很高興大家對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);
}
?>


【本文版權歸作者與奧索網共同擁有,如需轉載,請注明作者及出處】    

溫馨提示:喜歡本站的話,請收藏一下本站!

本類教程下載

系統下載排行

主站蜘蛛池模板: 巴彦县| 醴陵市| 新乡市| 鄂伦春自治旗| 温泉县| 皋兰县| 南川市| 屏东市| 马边| 陕西省| 龙山县| 黔江区| 龙南县| 登封市| 邵东县| 瑞安市| 峡江县| 洪洞县| 娄底市| 安吉县| 华坪县| 屏东市| 彭泽县| 壤塘县| 乃东县| 繁峙县| 平谷区| 临海市| 长兴县| 工布江达县| 蒙山县| 翁源县| 永宁县| 石景山区| 松原市| 保靖县| 如东县| 仪陇县| 凤凰县| 黄石市| 香港|