# BurnChart (/docs/charts/burn-chart)

BurnChart answers "will we finish on time?". It draws the **plan** line (dashed, full length to the deadline), the
**actual** line to today, and a **dotted projection** whose slope is a plain linear fit over the last few actual points
— provisional by construction, never a smoothed or optimistic curve. The gap label states the signed schedule landing,
because "will we finish" is a number, not a vibe.

```tsx
import { BurnChart } from "@microcharts/react/burn-chart";

<BurnChart
  data={{
    plan: [40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0],
    actual: [40, 35, 31, 27, 24, 21],
  }}
  title="Sprint 12"
/>
```

## Install

```tsx
import { BurnChart } from "@microcharts/react/burn-chart";

<BurnChart data={{ plan, actual }} title="Sprint 12" />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.


## When to use it

- **Good for** — a sprint burndown in a tab header, will-we-finish in a KPI card, plan vs actual with a projected
  landing.
- **Avoid for** — a single progress number (Progress) or a plain series (Sparkline).


## Variants

```tsx
<BurnChart
  data={{ plan: [40, 36, 32, 28, 24, 20, 16, 12, 8, 4, 0], actual: [40, 35, 31, 27, 24, 21] }}
  projection={false}
/>
<BurnChart
  data={{ plan: [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40], actual: [0, 5, 9, 13, 16, 19] }}
  mode="up"
/>
```

```tsx
<BurnChart
  data={{ plan: [4000, 3200, 2400, 1600, 800, 0], actual: [4000, 3400, 2800, 2300] }}
  locale="de-DE"
/>
```

With a `locale`, the accessible summary's numbers follow that locale's own grouping — "2.300" in German, not "2,300".

## Edge cases

```tsx
// plan=[] — history draws, the projection still runs toward zero, but the
// summary reports it without a "vs planned" comparison
<BurnChart data={{ plan: [], actual: [40, 35, 31, 27, 24, 21] }} />
```

```tsx
// actual isn't dropping — the projection never reaches zero, and the
// summary says so instead of implying a landing date
<BurnChart data={{ plan: [40, 36, 32, 28, 24, 20], actual: [40, 40, 40, 40] }} />
```

```tsx
<BurnChart data={{ plan: [40, 36, 32, 28, 24, 20], actual: [40] }} />
```

With no plan (`plan: []`), the projection still runs — the fitted slope only needs `actual` — but there's nothing to
compare it to, so the summary drops the "vs planned" clause. A stalled burn (`actual` flat) never reaches zero, so
`finishes` is `false` and the summary states that plainly rather than extrapolating a fake landing. A single `actual`
point draws no projection at all (the fit needs at least two).


## Why this default

The gap label, because "will we finish" is a number, not a vibe. History is drawn solid and exact; the projection is
dotted, muted, and computed as a linear fit over the last `max(2, ⌈actual/3⌉)` actual points — a stated method, never an
optimistic hand-drawn curve. When the recent burn flattens, the projection never reaches zero and the summary says so
outright ("not finishing at the current pace"), rather than implying a landing that isn't coming.

## Accessibility

The accessible name states progress against the plan and the projected landing — **"6 of 11 days in: 19 points done vs
20 planned — projected to finish 2 days late."**. The interactive entry steps the days; history announces actual vs
plan, and the dotted region announces the projection.

The interactive entry follows the shared [interaction contract](/docs/accessibility#one-interaction-contract):
arrow keys rove between units on both axes, `Home` and `End` jump to the ends, and a click, tap, `Enter` or
`Space` selects a unit — pinning its readout so it survives blur, until you select it again or press `Escape`.
On touch, a tap pins and a drag scrubs.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `data` (required) | `{ plan: number[]; actual: number[] }` | Remaining work per period (mode='down') or completed (mode='up'). |
| `mode` | `"down" \| "up"` | Burn-down (remaining → 0, default) or burn-up (done → scope). |
| `projection` | `boolean` | The dotted extrapolation to the deadline (default true). |
| `work` | `string` | Work-unit noun for the summary and readout. Defaults to `strings.burnWork` ('points' in EN), so a localized bundle replaces it. |
| `unit` | `string` | Period noun for the summary and gap label (default 'day'). |
| `label` | `"gap" \| "none"` | Signed schedule landing vs the deadline in a right gutter. |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
