Skip to main content
100%

Pie Padding II

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Nov 19, 2014

Seven pie slices represent the Fibonacci sequence, with angular padding between arcs separating them. A continuous animation cycles the padAngle from zero to its maximum value and back, causing the gaps between slices to expand and contract while their relative areas remain unchanged. The example uses D3 3.5’s `d3.layout.pie` with `.padAngle()` and `d3.svg.arc`, rendering SVG paths with a group element centered in the viewport. A `d3.timer` applies a cubic-in-out easing over 7.5 seconds, updating each arc’s path data frame-by-frame.

AI-generated description

D3 3.5’s d3.layout.pie and d3.svg.arc support angular padding to separate adjacent arcs. Increasing the padAngle increases the separation between arcs, but preserves their relative area, which is necessary for accurate perception.

The sides of adjacent arcs are normally parallel. When the specified padding angle is large (relative to the angular width of each arc), the arcs are truncated into wedges. This may be avoided by increasing the inner radius.

gpl-3.0 Licensed

Similar vizzes