Appearance
Are you an LLM? You can read better optimized documentation at /embed/docs/chart-types/pie.md for this page in Markdown format
Pie / donut
Share of a single total across categories. A donut is a pie with a hole.
Identity
chartType | pie · donut |
| Option bag | pie |
seriesData layout | categoryValue – columns [Category, Value] |
| Min grid | 2 rows × 2 columns |
| Orientation | N/A – axes disabled |
| Sample | Pie |
Minimal chartData
js
{
chartType: 'pie',
seriesData: [
['Category', 'Value'],
['North', 45],
['South', 30],
['West', 25],
],
title: { visible: true, text: 'Share' },
subtitle: { visible: false, text: '' },
}seriesData
js
[
['Category', 'Value'],
['North', 45],
['South', 30],
['West', 25],
]| Rule | Detail |
|---|---|
| Layout | categoryValue – not series-rows |
| Transpose | Do not use bar/line isDataTransposed: true patterns here |
| One measure | One value column |
Shared layout rules: chartData schema · seriesData.
Option bag: pie
| Field | Default (new charts) | Role |
|---|---|---|
innerRadiusRatio | 0 for pie; 0.5 for donut | Hole size, 0–1 (0 = full pie) |
scaleFactor | 0.9 | Overall pie scale inside the plot |
labelVisibilityThreshold | 0 | Hide tiny-slice labels below this share |
explode | [] | Per-slice explode offsets |
line | white stroke defaults | Slice border color / width / dash |
seriesStrokes / widths / dash | [] | Per-slice stroke chrome |
overrides | {} | Indexed style patches |
Donut
Ask for 'donut' – the hole is already open. You do not need to set innerRadiusRatio unless you want a different size:
js
{
chartType: 'donut',
seriesData: [['Category', 'Value'], ['North', 45], ['South', 30]],
}
// Override hole only when needed:
{ chartType: 'donut', pie: { innerRadiusRatio: 0.7 } }getChartData() returns chartType: 'pie' with innerRadiusRatio: 0.5. That round-trips correctly.
Axes & scales
Axes are disabled for pie / donut. Do not author axes for layout. Labels live in pie / series-label chrome.
Details: Axes · by chart type.
Type-specific behaviour
- Slice colors:
legend.colors. - Series labels default more visible on pie/donut than on bar/line.
- Prefer editor placement +
getChartData()for label leader lines and explode.
Pitfalls
- Feeding a bar/line
seriesRowsgrid into pie - Putting options in
bar/lineon a pie (foreign-option-bag) - Expecting
getChartData()to keepchartType: 'donut'— it returnspiewith the hole set - Setting
innerRadiusRatio: 5(must be0–1– validation throws)
Related
- chartData schema · Legend
- Sample: Pie