Creating a layout algorithm
Every chart makes assumptions about the kind and structure of the data that they can display. A scatter plot needs pairs of quantitative values, a bar chart requires categories with a quantitative dimension, and a tree map needs nested objects. To use a chart, the user will need to group, split, or nest the original dataset to fit the chart requirements. Functions that perform these transformations are called layout algorithms. D3 already provides a good set of layouts, from the simple pie layout to the more complex force layout. In this section, we will lean how to implement a layout algorithm, and we will use it to create a simple visualization using the barcode dataset.
The radial layout
The array with dates used in the barcode example can be visualized in several ways. The barcode chart represents every data item as a small bar in a time interval. Another useful way to display a series of events is to group them in intervals. The most common among these kind...