Chart
✓ functionalTell the Chart tab what story to draw before the result even arrives.
The chart directive prepares the result's Chart tab from a comment. It is the same chart you can configure interactively, but the setup travels with the query and comes back on every run. Use a view directive to open the Chart tab and a chart directive for the type, labels, series, and aggregation.
Syntax
-- sqlly view: chart
-- sqlly chart: kind:<type>[; label:<col>][; values:<cols>][; aggregate:<agg>][; order:<order>][; top:<n>][; navigate:<true|false>]
Fields are separated by ; and written as key:value; order does not matter. Only kind: is required, and the rest use the chart's defaults when omitted. Column names are flexible, so [Region], `Region`, and "Region" all resolve to the same column.
| Field | Meaning |
|---|---|
kind: | The chart type: bar, line, area, scatter, histogram, pie, or donut (required). |
label:col | Column whose values label the categories. Defaults to the first text column. |
values:col[,col…] | Numeric column(s) to plot as series. Defaults to auto-detecting the numeric columns. |
aggregate:agg | Collapse rows per category: none, sum, average, minimum, maximum, or count. (avg/min/max also accepted.) |
order:order | Category order: source, category (A–Z), or value (high–low). |
top:n | Keep at most n categories after ordering. |
navigate:true|false | Clicking a mark selects its source rows on the Grid tab (default true). |
Examples
-- sqlly view: chart
-- sqlly chart: kind:bar; label:Region; values:Sales
SELECT Region, Sales FROM sales;
For two series, summed per category and shown largest first:
-- sqlly view: chart
-- sqlly chart: kind:line; label:Month; values:Revenue,Cost; aggregate:sum; order:value; top:12
SELECT Month, Revenue, Cost FROM monthly;
Chart types
Each kind: value draws a different mark. The gallery below names what to expect; its screenshot placeholders are waiting for their real captures.







view: chart on the first non-empty line of the query; chart: can live on any comment line of its own. When several valid chart hints exist, the last one wins.