Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

PieChart

Parts of a whole. `innerRadius` makes it a donut with a centre label.

import { PieChart } from '@loidolt/theme-charts';

Example

Sheets by material

Pie chart of 5 parts totalling 1,603. Largest: Birch ply 812 (51%), Cork 351 (22%) and Acrylic 212 (13%).

Share of sheets

Pie chart of 5 parts totalling 1,603. Largest: Birch ply 812 (51%), Cork 351 (22%) and Acrylic 212 (13%).

Share of sheets
NameValueShare
Birch ply81250.7%
Cork35121.9%
Acrylic21213.2%
MDF1408.7%
Card885.5%

Notes

  • Negative values throw — a part of a whole cannot be less than nothing. The data table adds each part’s share.
  • Labels printed on slices take whichever ink reads better on that slice.

Props

Generated from the component source, so it cannot drift from the implementation.

PieChart props
PropTypeDefaultNotes
data required SliceDatum[]—The parts of the whole, one slice each.
tableLabels { nameLabel?: string; valueLabel?: string; shareLabel?: string }{}Headings of the data table columns.

Plus the attributes of Omit<ComponentProps<typeof Chart>, 'option' | 'table' | 'extensions'>andPieOptions, forwarded to the root element.