February 2019
Beginner to intermediate
284 pages
6h 20m
English
Pie and doughnut charts don't have to be complete circles. You can set the value of the circumference property (in radians) and use less than 360 degrees (2 * Math.PI radians). Using Math.PI as the circumference, you get a half-pie or half-doughnut chart. These charts are good to compare two or three values and may fit better in reduced spaces.
We modified the previous chart in the following example. It compares the 2017 populations of China and India with the rest of the world using a half-doughnut. The following fragment contains the relevant code. You can see the full code in Pie/pie-9-halfpie.html:
const numberOfEntries = 2; // ... const chartObj = { type: "doughnut", data: dataObj, options: { circumference: ...Read now
Unlock full access