PHP generates 3D percentage graph statistical results _ PHP Tutorial

Source: Internet
Author: User
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

Php tutorials generate 3d percentage graph statistics
/*
This program is based on the user's data to generate a percentage of 3d effect Picture Statistics effect a bit like a Chinese webmaster
*/
$ Image = imagecreatetruecolor (200,200); // Create a canvas named 200*200;

// 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...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.