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 where each slice is labeled with an animal name, with the text placed along the arc starting at each slice’s beginning. The chart uses D3.js version 3.5.6, with `d3.svg.arc` for the donut slices and `d3.layout.pie` to compute the arc angles from a hardcoded dataset of eight animal values. Color is assigned via a linear scale with an HCL interpolator, and labels are rendered using SVG `<textPath>` elements referencing the arc paths. The data is embedded directly in the script rather than loaded from an external file.

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>

Similar vizzes