February 2019
Beginner to intermediate
284 pages
6h 20m
English
A bar chart displays a list of categories associated with values represented by the length of the bars. To create a simple bar chart, we need a list of categories, as well as list of values.
Let's create a simple chart to display the volume of water in each ocean. We will need an array of categories, as follows:
const labels = ["Arctic", "North Atlantic", "South Atlantic", "Indian", "North Pacific", "South Pacific", "Southern"];
In addition, we will also need a corresponding array of values, as follows:
const volumes = [18750,146000,160000,264000,341000,329000,71800]; // 10^3 km3
The data object should contain a labels property, which will refer to the categories array, and a datasets property, which contains an array ...
Read now
Unlock full access