Chart
The Chart widget turns an SQL query into a line, bar or pie chart: revenue per month, orders per customer, shares per status. Viewers see legend and tooltips and, if configured, choose the time range themselves.
Setting up
Configure chart leads through the setup in steps; each step has Next, Apply saves as soon as type, query and mapping are complete.
- Type: Line, Bar or Pie chart. Switching resets the mapping.
- Data: the SQL query. For line and bar it returns one category column and one or more value columns (
SELECT monat, umsatz, kosten FROM …), for the pie exactly one label and one value (SELECT status, anzahl FROM …). Test runs the query and shows the columns and the first rows; without a successful test with at least one row there is no going further. - Mapping: for line and bar X axis (category) and under Y axis (values) one or more columns as chips, one series per column with the column name in the legend. For the pie Label and Value.
- Display: Chart title, Show legend (on), Smoothed lines, Stacked (line and bar), Horizontal (bar only), X axis label, Y axis label, Y axis unit such as
€orh, which is appended to the axis values. A preview shows the result immediately. - Time range: appears only if the query contains
@periodStartand@periodEnd. Here the offered periods and the Default time range are defined.
The robot icon in the dialog opens the SQL assistant, which proposes a query from a description.
What the query must return
- The order of the rows is the order on the axis: for time series
ORDER BY monat. - Value columns must be numbers; text is drawn as 0.
- With more than ten categories the labels are slanted.
LIMIThelps for top lists. - Time ranges:
WHERE datum >= date(@periodStart) AND datum < date(@periodEnd), details under SQL in widgets.
On the dashboard
Legend at the bottom, tooltip on hover, the pie as a ring. With a configured time range, the time range button is at the top; the browser remembers the choice per viewer. If the query returns no rows, the widget reads No data available. The chart loads when the dashboard opens, on Refresh dashboard and via the refresh icon in the header.
Example
Revenue per customer as bars, net and gross side by side:
sql SELECT COALESCE(c.document_name, '-') AS kunde, SUM(i.app_net_total) AS netto, SUM(i.app_gross_total) AS brutto FROM app_invoices i LEFT JOIN app_contacts c ON c.id = i.app_recipient GROUP BY 1 ORDER BY 3 DESCType Bar, X axis
kunde, Y axisnettoandbrutto, Y axis unit€.
Frequently asked questions
“Next” is grayed out in the step Data.
Test first. The mapping needs the columns from the test run, and the query must return at least one row.
Can colors be chosen?
Not in the dialog; the series get the colors of the color scheme in order. A connected AI assistant can set the widget setting colorPalette.
The pie chart shows only one area.
The query returns only one row, or all values except one are 0. The pie needs one row per share.
Months appear in the wrong order.
The axis follows the row order. Sort by a date column, not by the month name, and build the label only afterwards.
Next step
Heatmap: values as colored cells across hours, days, months or two categories.