Skip to main content

Chart widget

The chart widget renders a bar or line series from row data — revenue trends, orders per hour, occupancy by day. Series axes are declared, not scripted: you point at a row array and name the x and y fields.

Definition

ui/widgets.yaml (excerpt)
- id: revenue_chart
type: chart
title: Revenue trend
source: revenue
options:
rows_path: items
kind: line
x_key: day
y_key: total
FieldTypeRequiredDescription
idstringYesWidget id referenced by page placements.
typestringYeschart.
titlestringYesCard header.
sourcestringYesSource id from sources.yaml.
options.rows_pathstringYesPath to the row array in the payload.
options.kindstringYesbar or line — the only supported series kinds.
options.x_keystringYesRow field for the x axis.
options.y_keystringYesRow field for the y axis (numeric).

Series kinds

KindUse it forAvoid for
lineContinuous trends (revenue per day)Categorical comparisons
barCategorical comparison (orders per table)Dense time series (> 30 points)

Data flow

restaurant-pro's revenue chart is fed by the revenue connector source (revenue.series). Rows are grouped per day by the connector; the chart only plots what the source returns.

Restaurant Pro usage

ui/pages.yaml (excerpt)
- id: dashboard
layout: dashboard-grid
widgets:
- { widget: active_orders, span: 3 }
- { widget: revenue_chart, span: 9 }

The span-9 placement gives the trend room to breathe while the metric keeps the headline visible.

Guidelines

  • Pre-aggregate in the connector (revenue.series) rather than shipping raw transactions to the widget.
  • Keep x_key values ordered in the payload; the chart plots rows in array order.
  • One series per chart; compare metrics with separate placements instead of overlapping series.
  • Series colors come from the theme's accent token — never hardcode colors. See Themes.