# Donut chart

Donut sets one part against the rest. The second part is the point and is lit; the centre carries the number that says it.

> Live preview: see the chart playing at https://bettertyped.github.io/react-wrapped/docs/charts/donut/
>
> One part against the rest.

## Installation

```bash
pnpm add @react-wrapped/charts @react-wrapped/core gsap
```

## Usage

A chart is data, not markup. Hand a scene an object with `type` set and the numbers to draw, and the scene draws it and plays its entrance on the video's timeline.

```tsx
import { chartScene } from "@react-wrapped/scenes";

export const scene = chartScene(
  {
    eyebrow: "Your year",
    title: ["Donut."],
    lede: "One part against the rest.",
    chart: {
      type: "donut",
      parts: [
        { label: "Public", value: 707 },
        { label: "Private", value: 380 },
      ],
      centre: "35%",
    },
  },
  { key: "donut", label: "Donut" },
);
```

## Props

| Prop | Type | What it does |
| --- | --- | --- |
| `type` | `"donut"` | Picks this chart. |
| `parts` | `readonly [{ label: string; value: number }, { label: string; value: number }]` | The two parts. The second is the one the chart is about. |
| `centre` | `string` | The text in the middle, usually a percentage. |

## How it comes in

Every chart plays in the order it is read: what it is made of stands first, the numbers arrive with a direction, and the one thing the chart is about lands last with its pill. Nothing is on screen before its own entrance. See [how charts animate](https://bettertyped.github.io/react-wrapped/docs/charts/) for the shared rules.

## Related

- [Charts](https://bettertyped.github.io/react-wrapped/docs/charts/)
- [Rings chart](https://bettertyped.github.io/react-wrapped/docs/charts/rings/)
- [Days chart](https://bettertyped.github.io/react-wrapped/docs/charts/days/)
- [River chart](https://bettertyped.github.io/react-wrapped/docs/charts/river/)
- [Transitions](https://bettertyped.github.io/react-wrapped/docs/transitions/)

Source: https://bettertyped.github.io/react-wrapped/docs/charts/donut/
