> Native Solid 2 fork of [solid-recharts](https://github.com/yumemi-thomas/solid-recharts) (MIT, © Thomas Guehenneux), derived from [Recharts](https://github.com/recharts/recharts) (MIT, © recharts). Adapted documentation; neither project endorses this fork.

# PieChart

`PieChart` is the polar container for `Pie` series. It owns the chart's layout, scales, and interaction state; children like `Pie` and `Tooltip` register themselves into it.

```tsx
() => {

	const data = [

		{ name: "Search", value: 400 },

		{ name: "Direct", value: 300 },

		{ name: "Social", value: 300 },

		{ name: "Email", value: 200 },

	];

	const colors = ["var(--accent-9)", "var(--teal-9)", "var(--amber-9)", "var(--crimson-9)"];

	return <ResponsiveContainer width="100%" height={300} initialDimension={{ width: 560, height: 300 }}>

		<PieChart title="Traffic sources">

			<Pie data={data} dataKey="value" nameKey="name" innerRadius="45%" outerRadius="80%" paddingAngle={2}>

				<For each={data}>{(_, index) => <Cell fill={colors[index()]} />}</For>

			</Pie>

			<Tooltip />

		</PieChart>

	</ResponsiveContainer>;

}
```

## Props

| Prop                        | Type                           | Default          | Description                                         |
| --------------------------- | ------------------------------ | ---------------- | --------------------------------------------------- |
| `data`                      | `object[]`                     | —                | Source data array, one entry per pie slice          |
| `width`, `height`           | `number`                       | —                | Fixed size (omit when inside `ResponsiveContainer`) |
| `margin`                    | `{ top, right, bottom, left }` | `{ 5, 5, 5, 5 }` | Space around the plot area                          |
| `syncId`                    | `string`                       | —                | Sync tooltip across charts sharing the id           |
| `cx`, `cy`                  | `number \| string`             | `"50%"`          | Center position of the pie                          |
| `startAngle`, `endAngle`    | `number`                       | `0`, `360`       | Angle range swept by the pie                        |
| `onClick`, `onMouseMove`, … | `function`                     | —                | Chart-level mouse events with the active payload    |

The base props follow the Recharts 3.9.2 `PieChart` API (reference commit `b3451050`) that solid-recharts tracks; see the [Recharts PieChart reference](https://recharts.org/en-US/api/PieChart). The [next-suite release scope](/charts/docs/overview/releases) lists selected adaptations, not full Recharts 3.10.1 parity.

## Notes

- The default `layout` is `"centric"`, positioning the pie at the chart center.
- Use `innerRadius` on the `<Pie>` child to create a donut chart.
- Set `syncId` on two charts to mirror tooltips between them.

## See also

- Pie — the series component and its label/cell options
- Tooltip · Legend
