Skip to main content
100%

Donut Chart - Default Labels

✓ Published0🌍 Public
SShuanWu
Last edited May 14, 2016
Created on May 14, 2016

This example shows a donut chart with animal names placed at the start of each arc, using default label positioning. The chart is rendered in SVG with D3.js, using `d3.svg.arc` and `d3.layout.pie` to create the slices. Text labels are attached to each arc via `textPath` elements referencing the slice’s path ID. The data is hardcoded in the script, with a color scale mapping sequential indices to a diverging palette, and the “Other” slice is grayed out.

AI-generated description

This is the first "Animal Donut Chart" example of the Blog Placing Texts on Arcs with D3.js in which the texts are placed at the start of each arc. All without writing the SVG path notations yourself.

forked from <a href='http://bl.ocks.org/nbremer/'>nbremer</a>'s block: <a href='http://bl.ocks.org/nbremer/3a33bfdeda5b8f8c8cd2'>Text on an Arc - Animal Donut Slices - Default Arc Labels</a>

forked from <a href='http://bl.ocks.org/ShuanWu/'>ShuanWu</a>'s block: <a href='http://bl.ocks.org/ShuanWu/42c4f3ee44c3ba2b2036f30e24e1a215'>Text on an Arc - Animal Donut Slices - Default Arc Labels</a>

Similar vizzes