Skip to main content
100%

Pie charts labels

✓ Published0🌍 Public
TThanaporn-sk
Last edited Jul 29, 2017
Created on Jul 29, 2017

This example presents a donut chart where each slice has an animated label connected by a thin polyline. A "randomize" button triggers a smooth transition to a new dataset, and the labels reposition themselves, keeping their text anchored appropriately depending on which side of the chart they fall. The code uses d3.layout.pie, d3.svg.arc, and transition.attrTween to interpolate the slice arcs, label positions, and connector lines. It relies on d3.interpolate to handle the animation and source data is generated randomly from a fixed set of label names.

AI-generated description

This variation of a donut chart demonstrates how to add labels with lines. Clicking on the button changes the displayed data. Check Pie Chart with Labels and Missing Data to see how to handle transitions with missing/new data.

forked from <a href='http://bl.ocks.org/dbuezas/'>dbuezas</a>'s block: <a href='http://bl.ocks.org/dbuezas/9306799'>Pie charts labels</a>

mit Licensed

Similar vizzes