Klar

Charts / React basic charts / Part-to-whole

Pie chart

A simple part-to-whole split with every slice labelled on a leader line, small items grouped into Other, and an optional donut total.

React component PieChart, data through props. How a total splits into its pieces. Tags: pie, donut, share, part to whole, proportion, breakdown, leader lines.

Install

npm i klar-charts

import 'klar-charts/styles.css'
import { ThemeScope, PieChart } from 'klar-charts'

# or copy the source:
npx shadcn@latest add https://klar.run/r/basic-pie.json

Usage

<PieChart data={ordersByChannel} donut={d === 'donut'} totalLabel="Orders" height={340} ariaLabel="Share of orders by acquisition channel" />

Related pie charts