Skip to main content
100%

Pie Centroid

✓ Published0🌍 Public
Mmbostock
Last edited Jul 21, 2019
Created on Dec 29, 2015

A pie chart displays seven categorical slices with distinct colors, each marked by a black dot at its centroid. The centroids are computed using the `arc.centroid` method from d3-shape, which returns a point suitable for label positioning rather than the geometric center of the arc. The visualization renders to a Canvas element, with the pie drawn via `d3.arc` and the dots via `d3.symbol`, both configured with the Canvas context. The underlying data is the Fibonacci sequence `[1, 1, 2, 3, 5, 8, 13]`, and the entire layout is created using the d3.v4 alpha library.

AI-generated description

The black dots show the midpoint computed by d3-shape’s arc.centroid. Note that this is not the geometric center of the arc, which may be outside the arc; this method is merely a convenience for positioning labels.

gpl-3.0 Licensed

Similar vizzes