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 ...

Get D3.js: Cutting-edge Data Visualization 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.