Skip to content

Pie / donut ​

Share of a single total across categories. A donut is a pie with a hole.

Identity ​

chartTypepie · donut
Option bagpie
seriesData layoutcategoryValue – columns [Category, Value]
Min grid2 rows × 2 columns
OrientationN/A – axes disabled
SamplePie

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],
]
RuleDetail
LayoutcategoryValue – not series-rows
TransposeDo not use bar/line isDataTransposed: true patterns here
One measureOne value column

Shared layout rules: chartData schema · seriesData.


Option bag: pie ​

FieldDefault (new charts)Role
innerRadiusRatio0 for pie; 0.5 for donutHole size, 0–1 (0 = full pie)
scaleFactor0.9Overall pie scale inside the plot
labelVisibilityThreshold0Hide tiny-slice labels below this share
explode[]Per-slice explode offsets
linewhite stroke defaultsSlice 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 seriesRows grid into pie
  • Putting options in bar / line on a pie (foreign-option-bag)
  • Expecting getChartData() to keep chartType: 'donut' — it returns pie with the hole set
  • Setting innerRadiusRatio: 5 (must be 0–1 – validation throws)

Developer documentation for Chartbuddy Embed · Not the end-user Help Center · Help Center