Skip to main content
100%

Arc Padding

✓ Published0🌍 Public
Mmbostock
Last edited Dec 19, 2022
Created on Dec 2, 2015

This animation shows how directly setting an arc’s `padAngle` biases small slices, shrinking their visible area more than large ones. It uses the `d3.arc` and `d3.pie` APIs from d3.v4, drawing to a Canvas element. A `d3.timer` and `d3.easeCubicInOut` interpolate the pad angle between zero and a fixed value over a 2.5-second cycle, while the underlying data values `[1, 1, 2, 3, 5, 8, 13, 21]` remain static. The rendering first strokes a padded outline, then fills the arcs in gray.

AI-generated description

This animation demonstrates the pitfall of setting arc.padAngle directly: small arcs are disproportionately affected, introducing bias. If you set pie.padAngle instead, the relative areas of arcs are preserved.

gpl-3.0 Licensed

Similar vizzes