# Donut Chart: Sweeping Segments: Stat & chart element for AI agents

> Parts of a whole (2-5): ring segments sweep clockwise in order, the legend rows show percentages that add to exactly 100, and the centre total counts up.

Canonical page: https://agentframes.ai/elements/kernel/donut-chart/
Markdown: https://agentframes.ai/elements/kernel/donut-chart.md

## Overview

- Name: Donut Chart: Sweeping Segments (`donutChart`), an element: one HyperFrames block per size
- Part of: the [Kernel](https://agentframes.ai/packs/kernel.md) pack (31 of 50). Available only through the All-access subscription.
- Category: Stat & chart
- Purpose: Parts of a whole (2-5): ring segments sweep clockwise in order, the legend rows show percentages that add to exactly 100, and the centre total counts up.
- Pack: [Kernel](https://agentframes.ai/packs/kernel.md), included in All-access (from $14/month billed annually ($168/year), or $19 monthly)
- Subscribe: POST https://agentframes.ai/api/checkout/subscribe with interval=month or interval=year (optional currency=USD|GBP|EUR|AUD|CAD; 303 redirect to Stripe checkout; a human pays there). Then download any pack with the subscriber key: https://agentframes.ai/account.md
- Aspects: 16:9 (native), 9:16 (native), 4:5 (native), 1:1 (native)
- Canvases: works on Paper (light) (`paper`), Stone (warm grey) (`stone`), Night (dark) (`night`); avoid none
- Typical duration: 8.5s
- Speaker-safe: no
- Preview video (watermarked): https://agentframes.ai/media/kernel/donut-chart.mp4
- Poster: https://agentframes.ai/media/kernel/donut-chart.jpg
- Licence: [AgentFrames Licence](https://agentframes.ai/licence.md)

## Paste this into Claude Code

```text
Use the AgentFrames Kernel pack. Add a `donutChart` beat to plan.json on a `paper` canvas with slots `label`, `title`, `body`, `parts`, `centerLabel`, `unit`, `unitPosition`, `precision`, `source`, `cues`, `sceneIndex` and `sceneTotal` from my script. Then run validate → build → qa and show me qa/contact.jpg.
```

## Variables

| Variable | Type | Label | Description | Default |
|---|---|---|---|---|
| `label` | string | label | {"type":"string","minLength":1,"maxLength":30} | WHERE TIME GOES |
| `title` | string | title | {"type":"string","minLength":1,"maxLength":60} | An agent's task, by step |
| `body` | string | body | {"type":"string","minLength":1,"maxLength":96} |  |
| `parts` | string | parts | JSON string. {"type":"array","minItems":2,"maxItems":5,"items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":24},"value":{"type":"number","minimum":0,"maximum":1000000000000}},"required":["label","value"]}} | [{"label":"Reading sources","value":42},{"label":"Planning","value":18},{"label":"Writing","value":28},{"label":"Checking","value":12}] |
| `centerLabel` | string | centerLabel | {"type":"string","minLength":1,"maxLength":16} | seconds |
| `unit` | string | unit | {"type":"string","minLength":1,"maxLength":10} | s |
| `unitPosition` | enum | unitPosition | {"type":"string","enum":["suffix","prefix"]} | suffix |
| `precision` | number | precision | {"type":"integer","minimum":0,"maximum":2} | 0 |
| `source` | string | source | {"type":"string","minLength":1,"maxLength":90} | Illustrative data for the demo. |
| `cues` | string | cues | JSON string. {"type":"array","items":{"type":"number","minimum":0,"maximum":8.5},"maxItems":5} | [] |
| `sceneIndex` | number | Zero-based scene position (footer meter) |  | 0 |
| `sceneTotal` | number | Total scenes (footer meter) |  | 1 |

## What your agent can change

**Donut Chart: Sweeping Segments** (Data). Native 1920×1080, 8.5s at 30fps.

Parts of a whole (2-5): ring segments sweep clockwise in order, the legend rows show percentages that add to exactly 100, and the centre total counts up.

**Motion.** Each segment sweeps from where the last ended at its cue; its legend row rises; the centre total counts on the same timing.
**Why it moves.** change: each sweep shows a share of the whole.

### Mount

Copy every manifest file path → target into your project (plus `af-kernel-runtime`). Mount with a unique host id, `data-composition-id="af-kernel-donut-chart-16x9"`,
`data-composition-src="compositions/af-kernel-donut-chart-16x9.html"`, `data-duration="8.5"` and native `data-variable-values`.
Use the variant whose size matches your project (16x9, 9x16, 4x5, 1x1): each is laid out natively, never scaled.

### Content slots

Nested slots are JSON strings inside `data-variable-values`. Every slot is checked against `constraints.json` before anything draws;
the block stops with a message naming the slot, its value and the fix (it never truncates or shrinks text to fit). Measured layout
limits (lines per box, items per layout) are also enforced and reported the same way.

- `label`: string. {"type":"string","minLength":1,"maxLength":30}
- `title` (required): string. {"type":"string","minLength":1,"maxLength":60}
- `body`: string. {"type":"string","minLength":1,"maxLength":96}
- `parts` (required): JSON string. {"type":"array","minItems":2,"maxItems":5,"items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":24},"value":{"type":"number","minimum":0,"maximum":1000000000000}},"required":["label","value"]}}
- `centerLabel`: string. {"type":"string","minLength":1,"maxLength":16}
- `unit`: string. {"type":"string","minLength":1,"maxLength":10}
- `unitPosition`: string. {"type":"string","enum":["suffix","prefix"]}
- `precision`: whole number. {"type":"integer","minimum":0,"maximum":2}
- `source` (required): string. {"type":"string","minLength":1,"maxLength":90}
- `cues`: JSON string. {"type":"array","items":{"type":"number","minimum":0,"maximum":8.5},"maxItems":5}

- Percentages use largest-remainder rounding so they always total 100%.
- Values must be non-negative with a positive total.

Style (role "style", defaults from brand.json): `brandName`, `series`, `colourway` (paper | stone | night), `accent`,
`headingFont` (Geist | Inter), `monoFont` (Geist Mono | JetBrains Mono), `logo` (empty or inline base64 image), `footer`.
Footer meter: `sceneIndex` (zero-based) and `sceneTotal`.

### Timing

8.5s. Everything has landed by 5.1s (60%), then the scene holds for reading and lifts out over the last 0.4 s. A reading-time check rejects copy that would not be readable before the outro.
`cues` are scene-relative seconds (from your transcript) for each item; leave `[]` to spread items evenly (never closer than 0.7 s).

### Example

```json
{
  "label": "WHERE TIME GOES",
  "title": "An agent's task, by step",
  "parts": "[{\"label\":\"Reading sources\",\"value\":42},{\"label\":\"Planning\",\"value\":18},{\"label\":\"Writing\",\"value\":28},{\"label\":\"Checking\",\"value\":12}]",
  "centerLabel": "seconds",
  "unit": "s",
  "unitPosition": "suffix",
  "precision": 0,
  "source": "Illustrative data for the demo.",
  "cues": "[]"
}
```

Source: editable HTML + the shared runtime. Facts in the example content: see the pack's docs/SOURCES.md.

## FAQ

### What can my AI agent change in Donut Chart: Sweeping Segments?

Your agent fills the `label`, `title`, `body`, `parts`, `centerLabel`, `unit`, `unitPosition`, `precision`, `source`, `cues`, `sceneIndex` and `sceneTotal` slots through the block's data-variable-values (or the starter project's variables). Motion, timing, palette, fonts and the internal layout are protected, so the result keeps the Kernel look.

### Which aspect ratios does Donut Chart: Sweeping Segments support?

Donut Chart: Sweeping Segments is designed natively for 16:9, 9:16, 4:5 and 1:1. A typical beat lasts 8.5s.

### How do I get Donut Chart: Sweeping Segments?

Donut Chart: Sweeping Segments is included in the Kernel pack, which is part of the AgentFrames All-access subscription along with 49 other templates in this pack and every other pack on the store. You get the full source, the editing contracts and the agent instructions.

## More in Kernel

- [Bar Chart: Ruled Bars + Counters](https://agentframes.ai/elements/kernel/bar-chart.md): Compares 2-6 non-negative values as horizontal bars from a zero baseline to `max`, with ruled gridlines, counting values and a required source line.
- [Big Statistic: Counting Numerals Row](https://agentframes.ai/elements/kernel/big-statistic.md): 1-3 headline numbers with units and captions, counting up from zero (never past the value), with a required source line.
- [Progress to Target: Meter + Goal Tick](https://agentframes.ai/elements/kernel/progress-target.md): Progress toward a goal: the value counts up while the meter fills to it, a goal tick marks the target, and a gap label says how far is left.
- [Ranked Options: Score Bars That Sort](https://agentframes.ai/elements/kernel/ranked-options.md): 3-5 options with scores: bars grow in the order given, then the rows sort themselves into rank order and rank numbers appear.

## Community

Coming soon.
