Php drawing. please modify it .. -Php Tutorial

Source: Internet
Author: User
Php drawing. please modify it ..
 $ Zuidashujuzhi) $ zuidashujuzhi = $ shuju [$ I];} // calculate the image width $ img_kuan = $ zuo + $ you + $ jiange + count ($ shuju) * ($ kuan + $ jiange); // Image Height $ img_gao = 170; // An array storing the color bar height $ zhugaodu = array (); $ image = imagecreate ($ img_kuan, $ img_gao); $ white = imagecolorallocate ($ image, 0xEE, 0xEE, 0xEE ); // color bar color $ shuju_yanse = array (imagecolorallocate ($ image, 0x97, 0xbd, 0x00), imagecolorallocate ($ image, 0x00, 0x99, 0x00), imagecolorallocate ($ image, 0xcc, 0x33, 0x00), imagecolorallocate ($ image, 0xff, 0xcc, 0x00), imagecolorallocate ($ image, 0x33, 0x66, 0xcc), imagecolorallocate ($ image, 0x33, 0xcc, 0x33), imagecolorallocate ($ image, 0xff, 0x99, 0x33), imagecolorallocate ($ image, 0xcc, 0xcc, 0x99), imagecolorallocate ($ image, 0x99, 0xcc, 0x66), imagecolorallocate ($ image, 0x66, 0xff, 0x99); // axis color $ zuobiao_yanse = imagecolorallocate ($ image, 0x00, 0x00, 0x00 ); // horizontal axis imageline ($ image, $ zuo, $ img_gao-$ xia, $ img_kuan-$ you/2, $ img_gao-$ xia, $ zuobiao_yanse ); // Vertical axis imageline ($ image, $ zuo, $ shang/2, $ zuo, $ img_gao-$ xia, $ zuobiao_yanse); // Vertical Axis scale, four vertices are marked on the vertical axis. Therefore, you can calculate imageline ($ image, $ zuo, $ shang, $ zuo + 6, $ shang, $ zuobiao_yanse) separately ); imagestring ($ image, 3, $ zuo/4, $ shang, round ($ zuidashujuzhi), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 1/4, $ zuo + 6, round ($ shang + ($ img_gao-$ shang-$ xia) * 1/4 ), $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 1/4, round ($ zuidashujuzhi * 3/4 ), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, $ zuo + 6, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, round ($ zuidashujuzhi * 2/4), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, $ zuo + 6, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, round ($ zuidashujuzhi * 1/4 ), $ zuobiao_yanse); // get the height of each column for ($ I = 0; $ I
 


This can generate

Img. php? A = 5.4, 2, 30.2, 7.7, 6, 3.8, 4
Use the following parameter to obtain the image above ..
Now I want to get the column name, for example, 5.4. I divide it into three more attributes and display the name of each column. how can I improve the code.


And there is no limit on the number of types below, such as steel pipes, aluminum tubes, copper tubes, gold tubes ,..... There are several.
But there are only three attributes .... Each is an integer...

Please help me modify the code or give me a simple code .. Thanks.


Reply to discussion (solution)

 $ Zuidashujuzhi) $ zuidashujuzhi = $ shuju [$ I];} // calculate the image width $ img_kuan = $ zuo + $ you + $ jiange + count ($ shuju) * ($ kuan + $ jiange); // Image Height $ img_gao = 170; // An array storing the color bar height $ zhugaodu = array (); $ image = imagecreate ($ img_kuan, $ img_gao); $ white = imagecolorallocate ($ image, 0xEE, 0xEE, 0xEE ); // color bar color $ shuju_yanse = array (imagecolorallocate ($ image, 0x97, 0xbd, 0x00), imagecolorallocate ($ image, 0x00, 0x99, 0x00), imagecolorallocate ($ image, 0xcc, 0x33, 0x00), imagecolorallocate ($ image, 0xff, 0xcc, 0x00), imagecolorallocate ($ image, 0x33, 0x66, 0xcc), imagecolorallocate ($ image, 0x33, 0xcc, 0x33), imagecolorallocate ($ image, 0xff, 0x99, 0x33), imagecolorallocate ($ image, 0xcc, 0xcc, 0x99), imagecolorallocate ($ image, 0x99, 0xcc, 0x66), imagecolorallocate ($ image, 0x66, 0xff, 0x99); // axis color $ zuobiao_yanse = imagecolorallocate ($ image, 0x00, 0x00, 0x00 ); // horizontal axis imageline ($ image, $ zuo, $ img_gao-$ xia, $ img_kuan-$ you/2, $ img_gao-$ xia, $ zuobiao_yanse ); // Vertical axis imageline ($ image, $ zuo, $ shang/2, $ zuo, $ img_gao-$ xia, $ zuobiao_yanse); // Vertical Axis scale, four vertices are marked on the vertical axis. Therefore, you can calculate imageline ($ image, $ zuo, $ shang, $ zuo + 6, $ shang, $ zuobiao_yanse) separately ); imagestring ($ image, 3, $ zuo/4, $ shang, round ($ zuidashujuzhi), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 1/4, $ zuo + 6, round ($ shang + ($ img_gao-$ shang-$ xia) * 1/4 ), $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 1/4, round ($ zuidashujuzhi * 3/4 ), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, $ zuo + 6, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 2/4, round ($ zuidashujuzhi * 2/4), $ zuobiao_yanse); imageline ($ image, $ zuo, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, $ zuo + 6, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, $ zuobiao_yanse); imagestring ($ image, 3, $ zuo/4, $ shang + ($ img_gao-$ shang-$ xia) * 3/4, round ($ zuidashujuzhi * 1/4 ), $ zuobiao_yanse); // get the height of each column for ($ I = 0; $ I
 


This can generate

Img. php? A = 5.4, 2, 30.2, 7.7, 6, 3.8, 4
Use the following parameter to obtain the image above ..
Now I want to get the column name, for example, 5.4. I divide it into three more attributes and display the name of each column. how can I improve the code.


And there is no limit on the number of types below, such as steel pipes, aluminum tubes, copper tubes, gold tubes ,..... There are several.
But there are only three attributes .... Each is an integer...

Please help me modify the code or give me a simple code .. Thanks.


Where have you been...

It is easy to draw Chinese characters, and imagettftext can be easily completed.
But I cannot organize data for you.

Now I want to get the column name, for example, 5.4. I divide it into three more attributes and display the name of each column. how can I improve the code.
And there is no limit on the number of types below, such as steel pipes, aluminum tubes, copper tubes, gold tubes ,..... There are several.
But there are only three attributes .... Each is an integer... The vertical coordinates will be painted, and the horizontal coordinates will be drawn after being changed. You can use two loops to nest a data column. n is the number of types of tubes, and the interval length of each type is set. a bar chart is drawn when there is no interval. Then calculate the height coordinates of the graph and write the number characters.

There are a lot of graphic jquery plug-ins! Php painting.

Even php has a graphical package.

Even php has a graphical package.

Please kindly advise, I am a Cainiao...


Http://www.baidu.com? Wd = pChart


Http://www.baidu.com? Wd = pChart

I have read this and are studying its usage ..
Did someone tell me how to use it?

Take a look at the API and look for their example. copy it and modify the parameters.
The JS chart library is very convenient to use. There should be a case that fits your needs: Highcharts

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.