Let's talk about work.

Source: Internet
Author: User

What I mentioned in the first article was what I did last year ~ I have summarized my canvas achievements last year.

The balance chart control was drawn using canvas in the last two days.

~ \ (Too many rows )/~ I have a sense of accomplishment. I did not use third-party controls.

Maybe this is not worth mentioning for some heroes, but I am really cool. Who told me that I am a small shrimp?

Post it to help me see what else can be improved

The following information can be configured:

"Colors": ['yellow', 'cyany'] // only two color blocks are configured as required.

"Ymax": 10

"Ycount": 5

"Numyticks": 10

'Xlabels': ["s1", "s2", "s12", "s23", "s3", "s4", "s5", "s7 ", "s9"]

This is the balance chart we have developed based on project requirements. From the configuration information, the scalability is not very strong # O__O "...~~~

But in the future, such a column chart will not beat me down.

Step 1 draw the XY axis:

Y axis is very easy to draw ~ First draw the vertical line of the Y axis, then draw the Y length of the horizontal line./numyticks: Use the moveTO and lineTo of the canvas.

The X axis is a rectangular gradient ~ This is not difficult.

Step 2 draw bars:

When drawing bars, pay attention to the maximum value, minimum value, and average value. Here the algorithm is designed to show how high each bars is in the canvas.

Algorithms are very important. They can completely determine the level of your controls. Good algorithms can make your controls look simple and powerful. On the contrary, it will be annoying to lock others. of

Remember to subtract half of the X axis from the bars.

The last step is to draw labels:

This is also very simple and strange ~ Some problems are not the same. Before that, it was really difficult for me to go to Qingtian, as long as I suddenly feel like so easy.

In my opinion, when I draw this image, I just need to calculate the coordinates of the corresponding points.

What is the extensibility of this control?

 

 

 

 

 

 

Related Article

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.