Preparing data for pie and doughnut charts

Pie charts can't be used with any type of data. They should only be used to display part-whole relationships and contain not much more than half a dozen data values. The following screenshot shows what happens when you create a pie or doughnut chart with too much data. In this example, we loaded a doughnut chart containing the populations of almost 200 countries. It may be art, but not really a useful visualization:

Abusing a pie chart (code: Pie/pie-4-evilpie.html; see also Pie/pie-6-evilpie.html)

Even if you reduce this dataset to less than 20 values, it would still not be efficiently displayed ...

Get Learn Chart.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.