Header ("content-type", "text/html; charset = UTF-8 "); /* Sector statistical chart */ $ Image = imagecreatetruecolor (100,100);/* Create a canvas */ /* Set the color required for the canvas */ $ White = imagecolorallocate ($ image, 0xff, 0xff, 0xff ); $ Gray = imagecolorallocate ($ image, 0xc0, 0xc0, 0xc0 ); $ Darkgray = imagecolorallocate ($ image, 0x90, 0x90, 0x90 ); $ Navy = imagecolorallocate ($ image, 0x00, 0x00, 0x80 ); $ Darknavy = imagecolorallocate ($ image, 0x00, 0x00, 0x50 ); $ Red = imagecolorallocate ($ image, 0xff, 0x00, 0x00 ); $ Darkred = imagecolorallocate ($ image, 0x90, 0x00, 0x00 );
/* Fill in the background color */ Imagefill ($ image, 0, 0, $ white );
/* 3D production */ For ($ I = 60; $ I> 50; $ I --) { Imagefilledarc ($ image, 50, $ I, 100, 50,-160, 40, $ darknavy, IMG_ARC_PIE ); Imagefilledarc ($ image, 50, $ I, 100, 50, 40, 75, $ darkgray, IMG_ARC_PIE ); Imagefilledarc ($ image, 50, $ I, 100, 50, 75,200, $ darkred, IMG_ARC_PIE ); }
/* Draw an elliptical arc and fill it in */ Imagefilledarc ($ image, 50, 50,100, 50,-160, 40, $ darknavy, IMG_ARC_PIE ); Imagefilledarc ($ image, 50, 50,100, 50, 40, 75, $ darkgray, IMG_ARC_PIE ); Imagefilledarc ($ image, 50, 50,100, 50, 75,200, $ darkred, IMG_ARC_PIE );
/* Draw a string */ Imagestring ($ image, 3, 15, 55, "30%", $ white ); Imagestring ($ image, 3, 45, 35, "60%", $ white ); Imagestring ($ image, 3, 60, 60, "10%", $ white );
/* Output image */ Header ("content-type: image/png "); Imagepng ($ image );
/* Release resources */ Imagedestroy ($ image ); ?> |