📄 staticspaint.php
字号:
<?
include_once("inc/utility_all.php");
include ("inc/jpgraph/jpgraph.php");
include ("inc/jpgraph/jpgraph_pie.php");
include ("inc/jpgraph/jpgraph_pie3d.php");
include ("inc/jpgraph/jpgraph_gb2312.php");
$CUR_DATE=date("Y-m-d",time());
$ARRAY_FIELD=explode(",",$ARRAY_FIELD1);
$graphValues=explode(",",$graphValues1);
//----------MAXgraphValues-------
$ARRAY_COUNT=sizeof($graphValues);
$MAX_Values=$graphValues[0];
for($I=1;$I<$ARRAY_COUNT;$I++)
{
if ($graphValues[$I]>$MAX_Values)$MAX_Values=$graphValues[$I];
}
$TOTAL=ceil($MAX_Values/20)*20;
if ($TOTAL==0)$TOTAL=20;
$PERT=$TOTAL/20;
$field1[0]=$TOTAL;
$temp=1;
while($TOTAL>0)
{
$TOTAL=$TOTAL-$PERT;
$field1[$temp]=$TOTAL;
$temp=$temp+1;
}
//------------绘图---------------
$g2312 = new GB2312toUTF8();
$TOTAL=20;
$aveWidth=45; //11*40+20;
$aveHeight=20; //25*20+20;
$imgWidth=(sizeof($ARRAY_FIELD)*$aveWidth+20)+40;
$imgHeight=($aveHeight*20+35)+100;
$fieldcount=sizeof($ARRAY_FIELD);
$test = new TTF();
$font=$test->File(FF_SIMSUN,FS_BOLD);
// Define .PNG image
header("Content-type: image/png");
// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorDarkBlue=imagecolorallocate($image, 104, 157, 228);
$colorLightBlue=imagecolorallocate($image, 184, 212, 250);
// Create border around image
imageline($image, 20+10, 0+20, 20+10, $aveHeight*$TOTAL+20, $colorGrey);
imageline($image, 20+10, 0+20, $fieldcount*$aveWidth+20+10, 0+20, $colorGrey);
imageline($image, $fieldcount*$aveWidth+20+10, 0+20, $fieldcount*$aveWidth+20+10, $aveHeight*$TOTAL+20, $colorGrey);
imageline($image, 20+10, $aveHeight*$TOTAL+20, $fieldcount*$aveWidth+20+10, $aveHeight*$TOTAL+20, $colorGrey);
// Create grid
for ($i=1; $i<sizeof($ARRAY_FIELD); $i++){
imageline($image, $i*$aveWidth+20+10, 0+20, $i*$aveWidth+20+10, $aveHeight*$TOTAL+20, $colorGrey); //竖线
}
ImageTTFText($image,10,0,0,15,$colorDarkBlue,$font,"(".$temptitle=$g2312->gb2utf8($unit).")");
for ($i=1;$i<20;$i++){
imageline($image, 20+10, $i*$aveHeight+20, $fieldcount*$aveWidth+20+10, $i*$aveHeight+20, $colorGrey); //横线
imagestring($image,2, 0, ($i-1)*$aveHeight+20,$field1[$i-1], $colorDarkBlue); //输出内容
}
imagestring($image,2, 0, ($i-1)*$aveHeight+20,$field1[19], $colorDarkBlue);
for ($i=0; $i<sizeof($ARRAY_FIELD); $i++){
imagefilledrectangle($image, $i*$aveWidth+20+10, ($aveHeight*$TOTAL-($graphValues[$i]/$PERT)*$aveHeight)+20, ($i+1)*$aveWidth+20+10, $aveHeight*$TOTAL+20, $colorDarkBlue);
imagefilledrectangle($image, ($i*$aveWidth)+1+20+10, ($aveHeight*$TOTAL-($graphValues[$i]/$PERT)*$aveHeight)+2+20, (($i+1)*$aveWidth)-7+20+10, $aveHeight*$TOTAL-2+20, $colorLightBlue);
imagestring($image,3, $i*$aveWidth+23+10, ($aveHeight*$TOTAL-($graphValues[$i]/$PERT)*$aveHeight)-15+20, $graphValues[$i], $colorDarkBlue); //输出内容
$temptitle=$g2312->gb2utf8($ARRAY_FIELD[$i]);
ImageTTFText($image,10,270,$i*$aveWidth+32+10,$imgHeight-125+20,$colorDarkBlue,$font,$temptitle);
}
imagepng($image);
imagedestroy($image);
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -