Skip to main content
100%

Placing text within a arc

✓ Published1🌍 Public
LLiml
Last edited Apr 15, 2024
Created on Apr 9, 2024

This donut chart displays eight animal categories in equal segments, with labels positioned along the arc’s outer edge. Labels below the horizontal midline are flipped to remain upright, improving readability. Built with D3.js 3.5, the example uses `d3.svg.arc` for the donut slices and `d3.layout.pie` to compute the angles. It programmatically manipulates the SVG path data for the text placement, reversing the arc direction for segments where the end angle exceeds 90 degrees.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes