PHP plot (2)

Source: Internet
Author: User
Last time I talked about a simple method of drawing GD, and then I used GD as the simplest "graph"-a straight line.
This time I will draw a straight line down. I will not repeat the details in the previous code.
<?
Header ("Content-type: image/png ");
$ Im = ImageCreate (200,100 );
$ Col_black = ImageColorAllocate ($ im, 0, 0 );
$ Col_orn = ImageColorAllocate ($ im, 255,192, 0 );
// Use orange today.
// Use exactly the same as the imageline function,
ImageDashedLine ($ im, 0,100,199,100, $ col_orn );
// Draw a dotted line.
    
// Let's perform a test. To illustrate a problem.
$ Col_yel = ImageColorAllocate ($ im, 255,255, 0 );
// Yellow.
ImageLine ($ im, $ col_yel );
// Draw a yellow line at the bottom of the image.
ImageLine ($ im, 200,0, 200,100, $ col_orn );
// Try to draw a clear line at the far right of the image, and there is no result.
// This indicates that the coordinates of an image with a width of 200 and a height of 100 are () ).
    
ImagePNG ($ im );
ImageDestroy ($ im );
// This section ends first.
?>
Next, the effect will be great! I am also selling it now. PHP4.0.6 or above adds this usage-you can use the alternative
Draw lines in color! Example:
<?
Header ("Content-type: image/png ");
$ Im = ImageCreate (200,100 );
$ Col_black = ImageColorAllocate ($ im, 0, 0 );
$ Col_orn = ImageColorAllocate ($ im, 255,192, 0 );
$ Col_red = ImageColorAllocate ($ im, 255, 0, 0 );
$ Style = array ($ col_red, $ col_red, $ col_black, $ col_orn, $ col_black );

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.