PHP generates 3D percentage graph statistics. PHP generate 3D percentage graph statistical result this program is based on the user's data to generate a 3D percentage graph statistical effect a bit like the Chinese webmaster php Tutorial to generate a 3d percentage graph PHP generate a 3D percentage graph statistics results this program is based on the user's data generated 3D effect percentage picture statistics effect a bit like a Chinese webmaster
// Create multiple and differentiated colors
$ Red = imagecolorallocate ($ image, 255, 0, 0 );
$ Blue = imagecolorallocate ($ image, 255 );
$ Yellow = imagecolorallocate ($ image, 255,255, 0 );
$ Violet = imagecolorallocate ($ image, 255 );
$ White = imagcolorallocate ($ image, 255,255,255 );
$ Black = imagecolorallocate ($ image, 0, 0 );
// Use the for loop to create the underlying 3d effect
For ($ I = 120; $ I> 100; $ I --){
Imagefilledarc ($ image, 100, $ I, 200,120, $ red, img_arc_pie); // The img_arc_pie annotations are as follows:
Imagefilledarc ($ image, 100, $ I, 200,120, $ blue, img_arc_pie );
Imagefilledarc ($ image, 100, $ I, 200,120, 80,360, $ yellow, img_arc_pie );
}
// Bool imagefilledarc (resource image, int cx, int cy, int w, int h, int s, int e, int color, int style)
//
// Imagefilledarc () draws an elliptical arc in the image with cx and cy (0 in the upper left corner of the image. If the call succeeds, true is returned. if the call fails, false is returned. W and h respectively specify the width and height of the elliptic, and s and e parameters specify the start and end points with an angle. Style can be the values of the following values after bitwise or (or:
//
// Img_arc_pie
//
// Img_arc_chord
//
// Img_arc_nofill
//
// Img_arc_edged
// This layer is the effect of the top layer, so that the three-dimensional effect will come out!
Imagearc ($ image, 100,100,200,120, 0,360, $ black); // add a black edge ring to make the 3d effect more visible.
Imagefilledarc ($ image, 100,100,200,120, $ red, img_arc_pie );
Imagefilledarc ($ image, 100,100,200,120, $ blue, img_arc_pie );
Imagefilledarc ($ image, 100,100,200,120, 80,360, $ yellow, img_arc_pie );
// Add Percentage Data. if necessary, you can perform batch operations to input the input data to the image.
$ Str = iconv ("gbk", "UTF-8", "36%"); // This conversion is required if you want to enter Chinese characters. Example: Occupied: 30%;
Imagettftext ($ image, 10,360-15,100 + 70,115, $ white, "simhei. ttf", $ str );
Imagejpeg ($ image );
Imagedestroy ($ image );
Php Tutorial to generate a 3d percentage graph...