View on GitHub

reading-notes

Code 201 Reading Notes

Chart.js, Canvas

Using libraries, JavaScript’s functionality can be greatly expanded. For chart.js, by including a relatively minimal amount of paramaters to it and after targeting its canvas, clean and dynamic looking charts can be created. By following the documentation, and knowing where your data is going, it is relatively straightforward.

The canvas element (the subject of the rest of the articles) is where this content is created. It is the “canvas” that people target and have created libraries such as chart.js - which if I’m correct are a colleciton of various functions and constructors that allow for quick and powerful content creation - to allow people to use JavaScript for many purposes.

To create a canvas, it is an element that you give an id and height and width, and from there you can either draw directly onto it via multiple tools, or target the aforementioned Charts.js (as an example) to do far more with it. The canvas has a significant number of parameters and settings that can be utilized (hence it’s power), and this shows the basic tools to get something drawn onto it and given rudimentary properties.

Paul O’Brien (2020-06-15)

Return to Code 201 Reading Notes