February 2019
Beginner to intermediate
284 pages
6h 20m
English
Normally, you only display a single dataset with a pie chart, but multiple datasets are supported. They are displayed as concentric circles. Labeling the data in this case is mandatory, since it's impossible to visually compare the sizes of the slices.
The following example uses two datasets containing country population estimates from 1980 and 2015 to create a doughnut chart with the 1980 values in the inner circle, and the 2015 values in the outer circle. The relevant code fragments are shown as follows. You can see the full code in Pie/pie-10-multiset.html:
const dataset2015 = [189,206,258,320,1309,1397,3703], dataset1980 = [78,121,147,230,697,994,2191]; const labels = ["Pakistan", "Brazil", ...
Read now
Unlock full access