Skip to main content
100%

Arc generator (centroid)

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 3, 2018
Created on May 22, 2017

This example demonstrates how to compute and display the centroid of each arc in a donut chart, using the centroid to position labels. The visualization renders five colored arcs with white text labels placed at their geometric centers. The code uses the D3.js library, specifically the `d3.arc()` generator with `innerRadius` and `outerRadius` settings, and calls `arcGenerator.centroid()` to calculate label coordinates. The SVG output is styled with orange fills and bold white text, with data provided as an array of angle values in radians.

AI-generated description

Arc generator (centroid).

From D3 in Depth book by Peter Cook.

forked from <a href='http://bl.ocks.org/d3indepth/'>d3indepth</a>'s block: <a href='http://bl.ocks.org/d3indepth/c9fd848b9410cc543a437b34c266ac64'>Arc generator (centroid)</a>

gpl-3.0 Licensed

Similar vizzes