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.
import { PieChart, Pie, Tooltip, Legend } from "solid-recharts";
<PieChart width={500} height={300}>
<Pie data={data} dataKey="value" cx="50%" cy="50%" outerRadius={100} />
<Tooltip />
<Legend />
</PieChart>;
Loading source...
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 |
All other recharts PieChart props are supported; see the
recharts PieChart docs for the full matrix.
Notes
- The default
layoutis"centric", positioning the pie at the chart center. - Use
innerRadiuson the<Pie>child to create a donut chart. - Set
syncIdon two charts to mirror tooltips between them.