February 2019
Beginner to intermediate
284 pages
6h 20m
English
Each dataset is displayed in a line chart by a separate line. The following example adds a new set of values to our chart, that is, the average monthly temperatures measured in 1880. We can now plot both datasets in the same grid and compare them with the average temperatures in 2016, as follows:
// NASA/GISS Temperature anomalies from 1880 to 2016 let values2016 = [1.17,1.35,1.3,1.09,0.93,0.76,0.83,0.98,0.87,0.89,0.93,0.81]; let values1880 = [-0.3,-0.21,-0.18,-0.27,-0.14,-0.29,-0.24,-0.08,-0.17,-0.16,-0.19, -0.22]; Chart.defaults.global.elements.line.fill = false; let labels = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov", "Dec"]; let dataObj = { labels: labels, datasets: [{ label: ...Read now
Unlock full access