Pie and doughnut chart
Show the shares of one whole in a pie chart or a doughnut (donut) chart, with labels inside or outside, a total in the center and exploded slices.
- React
import { PieChart } from 'boardplot/react/pie';- Reference
- Data, options and sizing
- Use for
- Share of a whole, few parts · Doughnut with a center total · Revenue mix by channel
- Not for
- Negative parts; pie divides a nonnegative whole. A negative slice is not drawn and the center total is left out.
Device revenue with center total
A doughnut chart of 250.2 billion dollars of device revenue shows Mobile at 112.3 (45%), PC at 80.5 (32%) and Tablet at 57.4 (23%), with the Mobile slice pulled out.
doughnut-device-revenue
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "pie",
"data": {
"categories": [
{
"id": "mobile",
"label": "Mobile"
},
{
"id": "pc",
"label": "PC"
},
{
"id": "tablet",
"label": "Tablet"
}
],
"series": [
{
"id": "rev",
"label": "Device revenue",
"values": [
112.3,
80.5,
57.4
]
}
]
},
"options": {
"doughnut": 0.55,
"explode": {
"mobile": 0.06
},
"colors": "categorical",
"format": "1,234.5",
"title": "Mobile approaches half of global device revenue",
"subtitle": {
"company": "Camden Devices",
"measure": "Revenue by device class",
"period": "FY25"
},
"unit": "$bn",
"source": "Camden market model v4, FY25 actuals"
}
}Product line mix with an Others slice
A pie chart of $100m of revenue shows Platform at 38, Analytics at 24, Integrations at 16 and Support at 9, with the remaining 13 grouped as Other product lines.
others-renamed
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "pie",
"data": {
"categories": [
{
"id": "platform",
"label": "Platform"
},
{
"id": "analytics",
"label": "Analytics"
},
{
"id": "integrations",
"label": "Integrations"
},
{
"id": "support",
"label": "Support"
},
{
"id": "training",
"label": "Training"
},
{
"id": "hardware",
"label": "Hardware"
},
{
"id": "marketplace",
"label": "Marketplace"
}
],
"series": [
{
"id": "rev",
"label": "Revenue",
"values": [
38,
24,
16,
9,
6,
4,
3
]
}
]
},
"options": {
"topN": {
"n": 4,
"rest": true
},
"strings": {
"others": "Other product lines"
},
"title": "Four product lines earn 87% of revenue",
"subtitle": {
"measure": "Revenue by product line",
"period": "FY26"
},
"unit": "$m",
"source": "Illustrative product revenue"
}
}Revenue by channel in a thin ring
A thin doughnut of $100m of revenue shows Direct at 42, Partner at 28, Retail at 19 and Other at 11, so Direct and Partner give 70%.
doughnut-four-channel-revenue
JSON spec
This spec includes the theme shown and the options you selected.
{
"type": "pie",
"data": {
"categories": [
{
"id": "direct",
"label": "Direct"
},
{
"id": "partner",
"label": "Partner"
},
{
"id": "retail",
"label": "Retail"
},
{
"id": "other",
"label": "Other"
}
],
"series": [
{
"id": "revenue",
"label": "Revenue",
"values": [
42,
28,
19,
11
]
}
]
},
"options": {
"doughnut": 0.8,
"title": "Direct and partner sales contribute 70% of revenue",
"subtitle": {
"measure": "Revenue by channel",
"period": "FY26"
},
"unit": "$m",
"source": "Illustrative channel revenue"
}
}One channel highlighted in a spend mix
A doughnut of $400 thousand of media spend highlights Social at 120 (30%) in dark blue, with Search at 200 (50%) and Display at 80 (20%) in gray.
highlight-channel
JSON spec
This spec includes the theme shown and the options you selected.
Changed from the fixture: options.title.
{
"type": "pie",
"data": {
"categories": [
{
"id": "search",
"label": "Search"
},
{
"id": "social",
"label": "Social"
},
{
"id": "display",
"label": "Display"
}
],
"series": [
{
"id": "spend",
"label": "Spend",
"values": [
200,
120,
80
]
}
]
},
"options": {
"doughnut": 0.6,
"highlight": [
"social"
],
"strings": {
"notApplicable": "Not applicable"
},
"title": "Social takes 30% of media spend",
"subtitle": {
"measure": "Media spend",
"period": "FY26"
},
"unit": "$k",
"source": "Illustrative media plan"
}
}Minimal spec
Save this spec as pie.json and run the command.
{
"type": "pie",
"data": {
"categories": [{ "id": "renewals", "label": "Renewals" }, { "id": "new", "label": "New" }],
"series": [{ "id": "revenue", "label": "Revenue", "values": [70, 30] }]
},
"options": { "unit": "$k", "title": "Renewals contribute 70% of revenue", "source": "Illustrative data" }
}npx boardplot render pie.json --out pie.svg