Linear scales

A linear scale was used to for the following scatter chart, which plots the populations of several countries, comparing their population in 1980 (axis) with their population in 2015 (axis). The data is from the United Nations (see Data/WPP2017_UNH.csv in the GitHub repository for this chapter). The median line represents the points where the population is the same. Countries that appear in the shaded area above the middle line experienced a decrease in population:

A chart showing population increase/decrease from 1980 to 2015. Due to the different order of magnitude between China, India, and the rest of the world, the linear scale is not the best choice
Code: Numeric/numeric-1-linear.html

The two dots on the right side of the chart are India and China. All the other countries are concentrated in the lower-left corner of the chart. This chart is very difficult to read because it mixes values of different orders of magnitude. Most countries have a small population (in the order of millions), and when compared to China and India (billions), they end up cluttered near the beginning of the scale. In these situations, we should use a logarithmic scale.

Tooltips reveal the name of each country represented in the chart. You can check the full code for this chart in Numeric/numeric-1-linear.html. It's a mixed chart, with datasets of different types (line and scatter). We will explore mixed charts in Chapter 7, Advanced Chart.js.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset