Line chart

Use a line chart to show a measure changing across an ordered category such as time.

Every preview on this page is generated from the YAML shown below it using a fixed documentation dataset.

Basic

Use one ordered query.dimensions field for the horizontal axis and one query.measures field for the plotted value. Sorting by month keeps the line chronological.

Key fields
visuals:
  revenue_line:
    title: Revenue line by month
    type: line
    query:
      dimensions:
        purchase_month: orders.purchase_month
      measures:
        revenue: null
      sort:
        - field: purchase_month
          direction: asc
      limit: 30

Multiple series

Map query.series to split the measure into one line per order status; the compiler derives the required series-aware Cartesian specification.

Key fields
visuals:
  revenue_line_status:
    title: Revenue line by status
    type: line
    query:
      dimensions:
        purchase_month: orders.purchase_month
      series:
        field: orders.status
        alias: status
      measures:
        revenue: null
      sort:
        - field: purchase_month
          direction: asc
      limit: 60

Stepped line

Set presentation.step: true for discrete changes between periods, hide point symbols for a quieter trace, and enable data_zoom for long ranges.

Key fields
visuals:
  revenue_line_step:
    title: Stepped revenue line
    type: line
    presentation:
      step: true
      show_symbols: false
      data_zoom: true
    query:
      dimensions:
        purchase_month: orders.purchase_month
      measures:
        revenue: null
      sort:
        - field: purchase_month
          direction: asc
      limit: 30

API reference

Kind: chart. Renderer: echarts. Supported result shapes: category_series_value 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.seriesfield referenceSplits one measure into named series for compatible chart shapes.
query.sortsort listOrders query results by a returned field or measure alias.
presentation.data_zoombooleanfalsetrue falseAdds inside and slider zoom controls to supported Cartesian charts.
presentation.show_symbolsbooleantruetrue falseShows point symbols on line and area series.
presentation.stepbooleanfalsetrue falseDraws line segments as discrete steps.

Accessibility. Use a descriptive title and unit, and do not rely on color alone to distinguish series or values.