📄 area.php
字号:
<?php
session_start();
include("resp.inc");
resp_db_connect_i();
$originx=200;
$originy=200;
$margin=140;
$shadow=16;
$image =imagecreate($originx+$margin+10,$originy);
$white = imagecolorallocate($image, 0xFF, 0xFF, 0xFF);
$text_color = imagecolorallocate ($image, 233, 14, 91);
$monthname=mysql_fetch_array(mysql_query("select month(now())"));
$str=iconv("GB2312","UTF-8",$monthname[0]."月故障地域-部门发布图");
imagettftext($image,12,0,$margin,20, $text_color, "/usr/share/fonts/zh_CN/TrueType/gbsn00lp.ttf",$str);
$tmp=mysql_query("select indep,count(*) as dnum from deliver where tflag='1' group by indep with rollup");
$all=mysql_num_rows($tmp);
$tmod=1;
for($j=1;$j<=$all;$j++){
$tb=mysql_fetch_array($tmp);
$area[$j]=$tb[indep];
$dnum[$j]=$tb[dnum];
$jut=$tmod?abs(255-$j*20)%256:($j*10+50)%256;
$darkjut=$tmod?abs(200-$j*20)%256:$j*10%256;
$rac=$tmod?$j*10%256:abs(250-$j*20)%256;
switch($j%3){
case 0:
$color[$j]=imagecolorallocate ($image, $jut,$rac,$rac);
$darkcolor[$j]=imagecolorallocate ($image,$darkjut,$rac,$rac);
$tmod=$tmod?0:1;
break;
case 1:
$color[$j]=imagecolorallocate ($image, $rac,$jut,$rac);
$darkcolor[$j]=imagecolorallocate ($image,$rac, $darkjut,$rac);
break;
case 2:
$color[$j]=imagecolorallocate ($image,$rac, $rac,$jut);
$darkcolor[$j]=imagecolorallocate ($image, $rac,$rac,$darkjut);
break;
}
}
$arc[0]=0;
for($j=1;$j<$all;$j++){$arc[$j]=$dnum[$j]/$dnum[$all]*360+$arc[$j-1];}
for ($i =($originy/2+$shadow); $i >$originy/2; $i--) {
for($j=1;$j<$all;$j++){
imagefilledarc($image,$originy/2+$margin, $i,$originx,$originy/2, $arc[$j-1], $arc[$j], $darkcolor[$j], IMG_ARC_PIE);
}
}
for($j=1;$j<$all;$j++){
imagefilledarc($image, $originy/2+$margin,$originy/2,$originx,$originy/2, $arc[$j-1],$arc[$j], $color[$j], IMG_ARC_PIE);
}
// flush image
for($j=1;$j<$all;$j++){
$str=iconv("GB2312","UTF-8",$area[$j].":".$dnum[$j]);
imagettftext($image,10,0,5,$originy/$all*$j, $color[$j], "/usr/share/fonts/zh_CN/TrueType/gbsn00lp.ttf",$str);
}
imagepng($image,"area.png");
imagedestroy($image);
echo "<div style='position:relative; left:0px; top:0px'><img src='area.png'></img></div>";
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -