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.

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

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

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

FieldTypeDefaultAllowed valuesDescription
query.dimensionsfield mappingGroups query results and supplies category, hierarchy, matrix, graph, or geographic labels.
query.limitintegerno limitpositive integerCaps the number of rows returned to the renderer.
query.measuresmeasure mappingSelects the governed semantic measures consumed by the visual shape.
query.sortsort listOrders query results by a returned field or measure alias.
presentation.label_positionstringrenderer defaulttop bottom left right inside outsidePositions value labels relative to their marks.
presentation.rosebooleanfalsetrue falseScales pie sectors as a rose chart.
presentation.show_labelsbooleantruetrue falseShows 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.