Pie chart
Use a pie chart for a small number of categories that form a meaningful whole.
Every preview on this page is generated from the YAML shown below it using a fixed documentation dataset.
Pie presentation supports rose, labelPosition, and an optional outerRadius. Donut-only fields such as centerLabel and innerRadius are not part of the pie contract.
With outside conditional icon cues and a bottom legend, the chart reserves label columns as the card resizes. The authored outer-radius proportion is retained within the available plot area; use a small category count to keep the cues readable.
Basic
Use one categorical dimension and one metric for a part-to-whole comparison, sorting by value to keep the largest sectors easy to find.
visuals:
status_pie:
title: Orders by status pie
type: pie
query:
type: aggregate
dimensions:
- status
metrics:
- order_count
sort:
- field: order_count
direction: desc
presentation:
type: proportional
Rose sectors
Set presentation.rose: true to encode values through sector radius as well as angle, and show labels so the less familiar form remains readable.
visuals:
status_pie_rose:
title: Orders by status rose pie
type: pie
presentation:
type: proportional
rose: true
labels:
density: automatic
priority:
- selected
- anomaly
- threshold
maxCharacters: 24
minimumSpacing: 6
tooltipFallback: true
query:
type: aggregate
dimensions:
- status
metrics:
- order_count
sort:
- field: order_count
direction: desc
Compact labels
Move labels inside the sectors for a compact presentation; keep the category count low enough that internal labels do not collide.
visuals:
category_pie_inside:
title: Compact category pie
type: pie
presentation:
type: proportional
labelPosition: inside
labels:
density: automatic
priority:
- selected
- anomaly
- threshold
maxCharacters: 18
minimumSpacing: 6
tooltipFallback: true
query:
type: aggregate
dimensions:
- category
metrics:
- revenue
sort:
- field: revenue
direction: desc
limit: 6
API reference
Kind: chart. Renderer: echarts. Supported result shapes: category_value.
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
query.dimensions | field mapping | — | — | Groups query results and supplies category or hierarchy labels. |
query.limit | integer | no limit | positive integer | Caps the number of rows returned to the renderer. |
query.metrics | metric mapping | — | — | Selects governed semantic metrics consumed by the visual shape. |
query.sort | sort list | — | — | Orders query results by a returned field or metric alias. |
presentation.labelPosition | string | renderer default | automatic inside outside top | Positions labels relative to their marks. |
presentation.labels | label policy | hidden | hidden automatic dense always | Controls deterministic label density, priority, truncation, and tooltip fallback. |
presentation.rose | boolean | false | true false | Uses radial sector magnitude for a rose pie. |
Accessibility. Use a descriptive title and unit, and do not rely on color alone to distinguish series or values.