-
Book Overview & Buying
-
Table Of Contents
Learn D3.js - Second Edition
By :
A data visualization is a scaled representation of data. To encode data in visual artifacts, you map arbitrary values to graphical aspects, such as pixel dimensions, areas, colors, and other visual representations. This can be achieved with scales – functions that convert values from one dimension to another.
The d3-scale module, explored in this chapter, provides generators for reusable scaling functions. They can be used to expand or shrink a domain so that it fits in the output range of an SVG viewport, or convert values to dates and colors using interpolation, quantizing, or discrete mapping. These include continuous scales, such as linear, exponential, and logarithmic scales, interpolated scales frequently used for color schemes, and discrete scales, used for categorical, partitioned, and ordinal data.
The goal of this chapter is to introduce each scaling function, apply it to a small dataset, and generate a simple chart demonstrating its use. The code is minimal...