Skip to content
GitHub (opens in a new tab)

Pie

Part-to-whole share for a handful of segments, as a donut or solid pie.

stableOrganismcontracts/piechart.json

Preview

Chart

Pie

Part-to-whole share for a handful of segments, as a donut or pie. Not a Chart cousin.

Master

A sorted donut with the total in the centre and a split legend. Variants shows pie, stack and more.

Properties by status

2,568Total

Usage

Use PieChart for part-to-whole share with a handful of segments. Split for a labelled share tile. Stack when the card is a tall column.

Do's

  • Rough share at a glance for up to six segments
  • Dashboard tiles where proportion matters more than precise ranking

Don'ts

  • Comparing close values — use BarChart
  • Change over time — use LineChart
  • More than six segments without folding into Other
<PieChart
  title="Properties by status"
  data={[
    { label: 'Listed', value: 256 },
    { label: 'Under offer', value: 385 },
    { label: 'Under contract', value: 770 },
    { label: 'Closed', value: 514 },
    { label: 'Off market', value: 385 },
    { label: 'Draft', value: 258 },
  ]}
/>

When to use

  • Rough share at a glance for up to six segments
  • Dashboard tiles where proportion matters more than precise ranking

When not to use

  • Comparing close values — use BarChart
  • Change over time — use LineChart
  • More than six segments without folding into Other

What an agent reads

import { PieChart } from "agentic-ds-kit";
must
  • Title exposed on the figure when provided
  • Slices expose name, value, and percent on the hit target
  • Legend highlight matches slice hover; tooltip is supplementary
  • Table toggle keeps values readable in table view
  • animate is decorative only: no motion under prefers-reduced-motion, and hover, focus, legend and table work during the entrance
defaults
  • variant donut
  • layout split
  • showCenterTotal true
  • showTable true
  • sort true
  • maxSegments 6
  • size 240
  • otherLabel Other
  • centerLabel Total
  • emptyLabel No data for this range
  • isLoading false
  • animate false
stops if
  • Do not invent local chart wrappers
  • Do not use raw hex
  • Do not add chart-library compound APIs
  • Do not wrap a chart in a Card only to get a header button — pass actions

From contracts/piechart.json: must is the a11y requirements, defaults the prop defaults, stops if the doNot rules where the agent asks instead of inventing a cousin.

Props

NameTypeRequiredDefaultNotes
dataarrayNo—{ label: string, value: number, color?: string }[]
titlestringNo——
descriptionstringNo——
variantdonut | pieNodonut—
layoutsplit | stackNosplit—
showCenterTotalbooleanNotrue—
showTablebooleanNotrue—
sortbooleanNotrue—
maxSegmentsnumberNo6—
sizenumberNo240—
otherLabelstringNoOther—
centerLabelstringNoTotal—
emptyLabelstringNoNo data for this range—
isLoadingbooleanNofalse—
animatebooleanNofalseSlices sweep in clockwise from 12 o'clock when the chart first appears. Runs when the chart mounts; changing data on a mounted chart does not replay it. To replay (e.g. one chart per Tabs panel, or a range switcher), give the chart a key that changes with the data. Off under prefers-reduced-motion; the final state shows without JS
actionsslotNo—Kit Buttons in the chart header, before the Table toggle, like an icon-only Ask. ghost sm reads quietest. Setting it draws the frame even with no title.
  • Component
    →

    Bar

    Compare magnitudes across categories with vertical or horizontal bars.

  • Component
    →

    Line

    Change and progress over ordered samples as a line or area chart.