12
Creating Pies and Stacks
In this chapter, you will learn how to create pie charts, stacked bar charts, and stacked area charts. These visualizations require complex data structures, which can be built with the help of layout generators.
A layout generator doesn’t generate any shapes, but instead transforms a dataset, altering its structure and adding properties so that it can be more easily assembled as a visual structure, or used by a shape generator that expects a specific format. The two layout generators in the d3-shape module are used to build data structures for pies and stacks.
Pies are built from arcs, rendered as SVG paths using the arc shape generator. A pie chart uses arcs to create slices that fit perfectly in a circle. To draw ...
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