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.
Basic
Use one categorical dimension and one measure 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:
dimensions:
status: orders.status
measures:
order_count: null
sort:
- field: value
direction: desc
Rose sectors
Set presentation.rose_type: radius 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:
show_labels: true
rose: true
query:
dimensions:
status: orders.status
measures:
order_count: null
sort:
- field: value
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:
show_labels: true
label_position: inside
query:
dimensions:
category: orders.category
measures:
revenue: null
sort:
- field: value
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, hierarchy, matrix, graph, or geographic labels. |
query.limit | integer | no limit | positive integer | Caps the number of rows returned to the renderer. |
query.measures | measure mapping | — | — | Selects the governed semantic measures consumed by the visual shape. |
query.sort | sort list | — | — | Orders query results by a returned field or measure alias. |
presentation.label_position | string | renderer default | top bottom left right inside outside | Positions value labels relative to their marks. |
presentation.rose | boolean | false | true false | Scales pie sectors as a rose chart. |
presentation.show_labels | boolean | true | true false | Shows value labels directly on chart marks. |
Accessibility. Use a descriptive title and unit, and do not rely on color alone to distinguish series or values.