# Donut Chart

> An interactive SVG donut chart that pulls Weekly Activity data through a swappable async seam, then renders a stroke-arc ring with constant-width separators, a center total, a count-up share KPI with trend delta, a dotted-leader legend, and a hidden data table.

- Category: Chart
- Frameworks: Vanilla, React + CSS, React + Tailwind
- Design system: Caret
- Dark mode: no
- Access: premium (Atheros AI Pass)
- Tags: visualization
- Page: https://builder.atheros.ai/components/donut-chart
- Preview: https://d17nmjscumqk5d.cloudfront.net/builder/templates/tpl_builder_donut_chart/preview-0265c2b67270.webp

## Features

- External data seam: `js/data.js` holds the dataset and `js/api.js` exposes an async `fetchDonutData()` that clones it, so the mock swaps for a real endpoint without touching render code.
- SVG stroke-arc ring over a faint full-circle track, with constant-width surface-coloured separator lines so segment gaps stay uniform from the inner to the outer edge.
- Subtle staggered segment fade-in: each arc settles with a light opacity-and-scale animation on a 70ms per-segment delay, not a big draw-in sweep.
- Hover or click a segment or legend row to highlight it, fade the others, and pin the selection; click again to unpin.
- Center readout cross-fades between the aggregate total and the highlighted segment's count and share.
- Share KPI headline with an animated count-up and a colour-coded trend delta with a directional arrow.
- Dotted-leader legend rows with colour dots and tabular-numeral values, mirrored in a visually-hidden data table.
- Download tool exports the segment data (segment, count, share) as a CSV file.

## Accessibility

- **Decorative chart** — The SVG ring carries `aria-hidden="true"`; the same data is mirrored in a visually-hidden data table.
- **Data table caption** — The hidden table uses a caption naming the chart, with Segment, Count, and Share headers.
- **Card labelling** — The card is `aria-labelledby` the visible chart title.
- **Labeled control** — The download button carries an `aria-label` of "Download data as CSV".
- **Focus visibility** — A global `:focus-visible` outline drawn with the `--ring` token.
- **Reduced motion** — `prefers-reduced-motion` collapses all animations and transitions.

## Common questions

**Which frameworks is Donut Chart available in?**

Donut Chart ships as Vanilla, React + CSS and React + Tailwind — HTML, CSS, JS and React source you can copy, download or clone into Atheros AI Builder.

**Is Donut Chart free?**

Donut Chart is a premium component. Anyone can preview it; the source, downloads and AI customisation are included with Atheros AI Pass.

**Does Donut Chart support dark mode?**

Donut Chart ships a single light theme, drawn from the Caret design system's tokens.

## Get the code

Preview Donut Chart live, then sign in to copy or download the source, apply another design system, or ask the AI assistant to change it: https://builder.atheros.ai/components/donut-chart

Every component on https://builder.atheros.ai is also reachable from Claude Code, Cursor and Codex through the Atheros MCP server (paid plans). Component index: https://builder.atheros.ai/llms-components.txt
