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.

Key fields
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.

Key fields
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.

Key fields
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.

FieldTypeDefaultAllowed valuesDescription
query.dimensionsfield mappingGroups query results and supplies category or hierarchy labels.
query.limitintegerno limitpositive integerCaps the number of rows returned to the renderer.
query.metricsmetric mappingSelects governed semantic metrics consumed by the visual shape.
query.sortsort listOrders query results by a returned field or metric alias.
presentation.labelPositionstringrenderer defaultautomatic inside outside topPositions labels relative to their marks.
presentation.labelslabel policyhiddenhidden automatic dense alwaysControls deterministic label density, priority, truncation, and tooltip fallback.
presentation.rosebooleanfalsetrue falseUses 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.