Docs/Charts/PieChart

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>;
PieChart
pie-donut.tsxOpen ↗
Loading source...

Props

PropTypeDefaultDescription
dataobject[]—Source data array, one entry per pie slice
width, heightnumber—Fixed size (omit when inside ResponsiveContainer)
margin{ top, right, bottom, left }{ 5, 5, 5, 5 }Space around the plot area
syncIdstring—Sync tooltip across charts sharing the id
cx, cynumber | string"50%"Center position of the pie
startAngle, endAnglenumber0, 360Angle 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 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