Php Data Statistics graph instance code details .? Php *** time * www.ite5e.com * Note: If you have any questions, please reply. * The program has the call test code at the bottom. * ** Define (DEFAULT_FONT_PATH, c: windowsfonts
-
- /***
- * Time
- * Www.ite5e.com
- * Note: If you have any questions, you can reply.
- * The program has the call test code at the bottom.
- ***/
- Define ("DEFAULT_FONT_PATH", "c:/windows/fonts/simhei. ttf ");
- Class barbarism
- {
- Private $ _ x;
- Private $ _ y;
- Private $ _ h;
- Public $ _ l = 50;
- Private $ _ w = null;
- Private $ _ srcPoints = array ();
- Private $ _ points = array ();
-
- Public function _ construct ($ x, $ y, $ h, $ l = 50, $ w = null)
- {
- $ This-> _ x = $ x;
- $ This-> _ y = $ y;
- $ This-> _ h = $ h;
- $ This-> _ l = $ l;
- $ This-> _ w = $ w;
- $ This-> _ srcPoints = $ this-> getSrcPoints ();
- $ This-> _ points = $ this-> getPoints ();
- }
-
- Public function getSrcPoints ()
- {
- Return array (
- Array ($ this-> _ x, $ this-> _ y ),
- Array ($ this-> _ x $ this-> _ l, $ this-> _ y ),
- Array ($ this-> _ x (1.35 * $ this-> _ l), $ this-> _ y-(0.35 * $ this-> _ l )),
- Array ($ this-> _ x (0.35 * $ this-> _ l), $ this-> _ y-(0.35 * $ this-> _ l )),
- Array ($ this-> _ x, $ this-> _ y $ this-> _ h ),
- Array ($ this-> _ x $ this-> _ l, $ this-> _ y $ this-> _ h ),
- Array ($ this-> _ x (1.35 * $ this-> _ l ), $ this-> _ y $ this-> _ h-(0.35 * $ this-> _ l ))
- );
- }
-
- Public function getPoints ()
- {
- $ Points = array ();
- Foreach ($ this-> _ srcPoints as $ key => $ val)
- {
- $ Points [] = $ val [0];
- $ Points [] = $ val [1];
- }
- Return $ points;
- }
-
- Public function getTopPoints ()
- {
- Return array_slice ($ this-> _ points, 0, 8); // Top coordinate
- }
-
- Public function getBelowPoints ()
- {
- Return array_merge (array_slice ($ this-> _ points, 0, 2), array_slice ($ this-> _ points, 8, 4), array_slice ($ this-> _ points, 2, 2); // coordinates
- }
-
- Public function getRightSidePoints ()
- {
- Return array_merge (array_slice ($ this-> _ points, 2, 2), array_slice ($ this-> _ points, 10, 4), array_slice ($ this-> _ points, 4, 2); // coordinates on the right
- }
-
- Public function draw ($ image, $ topColor, $ belowColor, $ sideColor, $ borderColor = null, $ type = LEFT)
- {
- If (is_null ($ borderColor ))
- {
- $ BorderColor = 0 xcccccc;
- }
-
- $ Top_rgb = $ this-> getRGB ($ topColor );
- $ Below_rgb = $ this-> getRGB ($ belowColor );
- $ Side_rgb = $ this-> getRGB ($ sideColor );
- $ Top_color = imagecolorallocate ($ image, $ top_rgb [R], $ top_rgb [G], $ top_rgb [B]);
- $ Below_color = imagecolorallocate ($ image, $ below_rgb [R], $ below_rgb [G], $ below_rgb [B]);
- $ Side_color = imagecolorallocate ($ image, $ side_rgb [R], $ side_rgb [G], $ side_rgb [B]);
-
- Imagefilledpolygon ($ image, $ this-> getTopPoints (), 4, $ top_color); // draw the top surface
- Imagepolygon ($ image, $ this-> getTopPoints (), 4, $ borderColor); // draw the top edge
-
- Imagefilledpolygon ($ image, $ this-> getBelowPoints (), 4, $ below_color); // draw the following
- Imagepolygon ($ image, $ this-> getBelowPoints (), 4, $ borderColor); // draw the bottom edge
-
- If ($ type = LEFT)
- {
- Imagefilledpolygon ($ image, $ this-> getRightSidePoints (), 4, $ side_color); // draw the right side
- Imagepolygon ($ image, $ this-> getRightSidePoints (), 4, $ borderColor); // draw side edges
- }
- }
-
- Public function getRGB ($ color)
- {
- $ Ar = array ();
- $ Color = hexdec ($ color );
- $ Ar [R] = ($ color> 16) & 0xff;
- $ Ar [G] = ($ color> 8) & 0xff;
- $ Ar [B] = ($ color) & 0xff;
- Return $ ar;
- }
- }
- Class Bardate
- {
- Private $ _ W;
- Private $ _ H;
- Private $ _ bgColor = "ffffff ";
- Private $ _ barHeights = array ();
- Private $ _ barTexts = array ();
- Private $ _ barColors = array ();
- Public $ _ title;
- Public $ _ paddingTop = 30;
- Public $ _ paddingBottom = 100;
- Public $ _ paddingLeft = 45;
- Public $ _ paddingRight = 2;
- Public $ _ barL = 50;
- Public $ image;
Http://www.bkjia.com/PHPjc/486183.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/486183.htmlTechArticle? Php/*** time (* www.ite5e.com *) Note: reply if you have any questions. * The program has the call test code at the bottom. * **/Define ("DEFAULT_FONT_PATH", "c:/windows/fonts /...