Image图象--网格(PHP)
时间:2007-05-25 来源:nothing9
http://www.php.net/manual/zh/ref.image.php
// Define variables
$Values=array(120,190,130,155,150,140,320,150,140,186,240,128,650);
$imgWidth=50;
$imgHeight=20;
$grid=5;
$graphspacing=0.07;
//Scales number of vertical grid lines for the number of data to print
$gridW=$imgWidth/(count($Values)-1);
//Get min and max values to scale image
for ($i=0; $i$max){$max=$Values[$i];}
}
//Min values are less the maximum...
$min = $max;
for ($i=0; $i
for ($i=0; $i
// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorBlue=imagecolorallocate($image, 0, 0, 255);
// Create border around image
imageline($image, 0, 0, 0, $imgHeight, $colorGrey);
imageline($image, 0, 0, $imgWidth, 0, $colorGrey);
imageline($image, $imgWidth-1, 0, $imgWidth-1, $imgHeight-1, $colorGrey);
imageline($image, 0, $imgHeight-1, $imgWidth-1, $imgHeight-1, $colorGrey);
// Create grid
for ($i=1; $i
//Create the lines connecting points
for ($i=0; $i
// Output graph and clear image from memory
imagepng($image);
imagedestroy($image);
?>
相关阅读 更多 +
排行榜 更多 +