Html5 and html5 tutorials

Source: Internet
Author: User

Html5 and html5 tutorials

The simple part of canvas is not mentioned first.

Let's talk about some of the problems I encountered today. Although simple, I want to summarize them and it will seem convenient.

First attach a chartjs (canvas to draw the icon, convenient) Official Website: http://www.chartjs.org

Usage: <script src = "Chart. js"> </script>

Var chart = new Chart (context );

The next step is to create different tables as needed, and the methods for defining data in different tables are different.

There will be a demo in the picture.

Finally: chart. Table Name (the name of the array where your data is stored );

 

The following are the problems encountered during circle painting:

DrawImage () used for canvas image painting may cause loading errors or drawing errors (mainly chrome and firefox problems)

Solution: Add a loading function to your img object

Img. onload = function (){

Context. drawImage ();

}

Canvas method:

Context. translate (x, y) Note that it is relative to the last displacement

Context. scale () to zoom in or out on the original canvas

Context. rotate (Math. PI/n); rotate relative to the original canvas

 

That's all ........ I hope I can help some of my friends who are learning together.

 

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.