Scales
What if a new planet is discovered that is 10 times the largest distance? The bars wouldn't fit and their widths would need to be recalculated! D3 also provides a solution for this: scales.
Scales are mappings between different dimensions. In our case, we have to deal with two dimensions: the dimension of the data, called the domain, and the dimension of the graphics context where the data will be displayed, called the range. Before using a scale, you have to configure its domain and range. There are several different kinds of scales in D3, including linear and logarithmic scales, with many configuration options.
A scale is created with a special generator function available in the d3-scale module. To use this module, you need to load ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access