February 2019
Beginner to intermediate
284 pages
6h 20m
English
Just like the bar chart, you need to load the Chart.js JavaScript library, place a <canvas> object somewhere in the <body> of your page, and create a new chart referring to the ID of the canvas, and an object with the chart data. The chart object should specify line as the chart type. The following code is the minimum you need to create a line chart with the global defaults provided by Chart.js:
<html> <head> <script src=".../Chart.min.js"></script> </head> <body> <canvas id="my-line-chart" width="400" height="200"></canvas> <script> const values = [1.17,1.35,1.3,1.09,0.93,0.76,0.83,0.98,0.87,0.89,0.93,0.81]; const labels = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; const dataObj ...
Read now
Unlock full access