No slash command · from anofox-visualization
Builds interactive SQL dashboards from plain-text requests using anofox-visualization. Covers charts, KPIs, tables, filters, diagrams, and the full ::ROLE cast model.
Ships in anofox-visualization. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Extension: anofox_visualization (CalVer 2026.11.18) | Tools: dashboard CLI (--describe, --check, --roles), browser builder, serve | Docs: docs/DOCS.md, docs/dashboard-design.md in the repository
A dashboard is a .sql script. Tag output columns with ::ROLE casts; each annotated SELECT becomes a panel (chart, KPI, table, input). Statements without a role (CREATE TABLE, SET, LOAD, …) run as setup, in order, on one session. Your output is one SQL script.
Get the intention clear first (required). A dashboard answers one reader's question so they can decide something; build for that, not for the data. Before any SQL, state this intent brief in a few lines:
-- @title and ::DASHBOARD_TITLE.If the question, the decision, a key measure's definition or the period is unclear — or the request names only data ("visualise this table", "a dashboard for sales") — stop and ask before building. Ask at most three short questions, each with concrete options taken from the schema (dashboard --describe): "Which question should it answer: (a) which regions are behind plan, (b) how revenue develops week by week, (c) which products drive returns?". Do not build a generic "everything about the table" dashboard and do not guess a definition. When the request is clear, don't ask; state the brief in one or two lines and go on.
Every panel must serve the brief: drop a panel you can't tie to the question, the decision or a requested filter.
Ground on the schema (required). Never invent columns. dashboard --describe <table | 'file.parquet' | read_csv(…)> [--db file.duckdb] prints each column's type, min / max, approx-distinct (low = discrete → bar / category; high = search / paged) and null %.
Pick panels for the brief: KPIs for headline numbers, a line for trends, bars for category comparisons, a table for detail, inputs for filtering (table Pick the chart below).
Lay it out: SELECT n::COLUMNS;, ::COL per panel, KPIs in a ::GROUP box, ::TAB / ::SUBTAB for sections, ::VIEW for alternative views of one panel (a Lines/Bars/Table switcher over the same query).
Write the SQL: one annotated SELECT per panel, top to bottom.
Wire interactivity if asked: inputs and cross-filter.
Validate and repair (required). dashboard --check file.sql [--json] [--strict] [--no-design] [--db prebuilt.duckdb] runs every statement in a fresh session. Repeat until it prints clean (exit 0). Do not finish on unvalidated SQL.
Self-critique against the design contract below, re-check.
Visual review (required for a finished dashboard). --check never looks at the render: scripts/shoot.sh --dash <dir> [--init <file> --workdir <dir>] --tabs "A,B" --out <dir> screenshots each tab; grade the PNGs against docs/dashboard-visual-review.md (clipped labels, colliding colours, broken number formats, empty panels, no hierarchy) and fix every blocker / major.
dashboard --check diagnostics| Code | Severity | Meaning / fix |
|---|---|---|
sql-error | error | the statement failed (message from DuckDB) |
silent-setup | error | a query with ::ROLE casts outside its main SELECT list ran as setup: the panel vanished (casts in a CTE body / subquery) |
render-error | error | the chart cannot be drawn (missing required aesthetic, e.g. ::HEATMAP without ::YAXIS) |
render-warning | warning | renders, but the engine dropped data: non-finite values (NaN, ±Inf, log of ≤ 0), a stat layer with too little data (density of one value, smooth on two points). Filter in SQL (WHERE isfinite(x), NULLIF) |
empty-panel | warning | 0 rows: a blank card (often a filter on an unset variable); not raised after an ::EMPTY message |
optional/missing | note | a -- @requires <path> input is missing: the panel reads "Not available", a ::TRACK strip is left out, a ::TAB / ::SUBTAB is hidden with its panels (not a failure, --strict passes) |
totals/summed-rate | note | a 'sum'::TOTALS (or a bare sum in the list) would also sum a rate / percentage column it doesn't name — name it: 'Per 10k: none; sum' |
totals/unknown-column | note | a ::TOTALS 'name: agg' entry names no column of the next table (raw name or header, case-insensitive) — it is ignored; fix the name, or separate entries with ; when a header holds a comma |
box/missing, box/unordered, box/null | error / warning / warning | a box from statistics without ::Q1/::MEDIAN/::Q3, with one whisker, without ::XAXIS or beside a chart measure; Q1 ≤ median ≤ Q3 broken or a whisker inside the box; a NULL quartile (not drawn) |
requires/unknown-variable, requires/empty-alternative, requires/bad-variable, requires/on-setup, requires/tab-always-hidden | warning (--strict fails) | a ${name} in -- @requires with no value here (that path counts as missing; --check --data <dir> sets anofox_data); a | / a || b / a line with no path; a malformed ${…}; @requires on a setup statement that reads no file (a viewer could skip it: put it on the statement that reads the file); a tab's ${name} set only by a SET VARIABLE below the tab (a locked server always hides it: set it above) |
view/duplicate-label, view/empty-label, view/duplicate-name, view/bad-name, view/unbalanced-group (error) · view/lone, view/computed-label, view/mixed-names, view/empty, view/open-ended, view/stray-end (warning) · view/input-inside, view/unnamed (note) | mostly warning, five are errors | a ::VIEW switcher's label repeated / blank / a computed expression; two groups sharing one id, or an alias that isn't a plain identifier; a ::GROUP opened inside a view not closed inside it; a group with only one alternative; different aliases inside one group; an alternative with no rendering statement; no ::ENDVIEW with the last view holding the most panels; a stray ::ENDVIEW; an input inside a view (its control only shows there); 2+ groups in the script with one unnamed |
view-placement/unknown-value (error) · view-placement/not-single-panel, view-placement/ambiguous, view-placement/orphan, view-placement/computed-value (warning) | mostly warning, one is an error | a ::VIEW_PLACEMENT value other than 'row'/'header'; 'header' requested but an alternative isn't exactly one panel; combined with other columns instead of its own statement; not directly before a ::VIEW group's first marker; a computed (non-literal) value — each falls back to 'row' |
animate/unknown, animate/reveal-no-xline, linestyle/unknown, story/bad-by, transition/unknown, hover-focus/unknown, points/unknown, tooltip/unknown-placeholder, tooltip/bad-format, tooltip/unknown-mode | warning | an ::ANIMATE value that is not auto/draw/grow/reveal/none; 'reveal' without an ::XLINE to start from; a ::LINESTYLE that is not flow/dashed/solid; a ::STORY_BY that is not x/series (or series without a ::CATEGORY); a ::TRANSITION that is not tween/none; a ::HOVER_FOCUS that is not series/none; a ::POINTS that is not auto/none/always; a ::TOOLTIP_FORMAT/::TOOLTIP_HEADER placeholder that is not x/y/series or a ::TOOLTIP alias, a decimals format other than .0f….10f, a ::TOOLTIP_MODE that is not shared/single/none |
legend/bad-value, legend/no-legend | warning | a ::LEGEND value that is not none/top/right/bottom/left; ::LEGEND on a panel with no legend or colourbar at all (a KPI, table, text, gauge, candlestick, calendar, sparkline, histogram, waterfall, bullet, funnel, diagram, track, or a chart without a ::CATEGORY) |
figure/unknown-cell, figure/duplicate-cell, figure/bad-weights, figure/bad-option, figure/not-a-chart, figure/unclosed, figure/nested (error) · figure/unplaced-cell, figure/empty, figure/stray-end (warning) | mostly error | a ::LAYOUT name that is no cell of the figure (cells: -- @name or position); a cell placed twice; ::WIDTHS/::HEIGHTS matching no group's cell count; an unknown ::AXES_COLLECT/::TAG_LEVELS/::FIGURE_NCOL; a ::PAGED table, map, contract plot or ::TRACK inside a figure; no ::ENDFIGURE; a figure inside a figure; a cell ::LAYOUT leaves out; no chart in the figure; ::ENDFIGURE without ::FIGURE |
form/no-value, form/unknown-type, form/no-options, form/bad-show-if, form/bad-preset, form/bad-distribution (error) · form/bad-value, form/bad-range, form/slider-range, form/duplicate-field, form/no-key, form/too-many-fields, form/bad-width, form/partial-sections, form/unknown-layout (warning) | mostly error | a ::FORM without a value column; a field type that isn't number/slider/dropdown/toggle/date/text/preset/distribution; a distribution value or family it can't read; a dropdown without options; a show_if not written 'field=value' / 'a=x & b=y | c=z' or naming no field; a preset whose options isn't a JSON object of field values, or sets an unknown field / a value it doesn't take; a value outside its options / min-max or not a number; a slider without min/max; a key twice; an empty key; more than 64 fields; width not half/full; a section on some rows only; a ::FORM_LAYOUT not list/tabs/accordion |
track/no-chart | warning | a ::TRACK that does not directly follow a chart with a numeric / date ::XAXIS (only a ::HEIGHT may sit between): it is drawn as a panel of its own |
annotation/unpaired | warning | a label / range end without its partner, or unequal numbers of ::BAND_LOWER and ::BAND_UPPER |
diagram/null-id, diagram/duplicate-node, diagram/unknown-node, diagram/bad-edges, diagram/bad-style, diagram/bad-direction, diagram/too-large | warning | a ::DIAGRAM row without an id; an id twice (the first row wins); an edge naming an id that is no row (not drawn); ::EDGES that is not a list of {from, to} structs; an edge style that is not solid/dashed/flow; a ::DIRECTION that is not LR/TB; more than 150 nodes / 300 edges (the first ones are drawn) |
diagram_mode/unknown (error) · diagram_mode/no-diagram (warning) | error / warning | ::DIAGRAM_MODE other than 'edit' / 'view'; a ::DIAGRAM_MODE without a ::DIAGRAM column in the same SELECT (#682) |
diagram_check/no-diagram | warning | a ::DIAGRAM_CHECK not right before an editable ::DIAGRAM (only a ::DIAGRAM_PALETTE / ::COL / ::HEIGHT in between) — nothing runs it (#699) |
chart/needs-xaxis, input/many-buttons, input/list-option, thresholds/bad-rule, thresholds/no-column, thresholds/in-table, asof/unparseable, asof/bad-stale, callout/unknown, callout/no-text, markdown_style/unknown, markdown_style/no-text, markdown_style/conflicts-with-callout, markdown_style/caption-no-chart, markdown_tone/unknown, markdown_tone/no-text, markdown_tone/ignored, markdown/unknown-placeholder, markdown/unknown-format, markdown/bad-math, image/bad-src, image/outside-folder, image/not-in-assets, image/svg-no-size, image/too-large, image/empty, image/no-alt, image/many, markdown/image-bad-src, markdown/image-not-in-assets, markdown/image-svg-no-size, markdown/image-too-large, markdown/image-no-alt, markdown/placeholder-in-image, diagram/bad-pin, diagram/partial-pins, policy/* | mostly warning (chart/needs-xaxis, markdown_tone/unknown: error) | a waterfall / bullet / funnel without ::XAXIS; too many ::BUTTONS options (use a dropdown); a malformed or misplaced ::THRESHOLDS; an ::ASOF that is no date / a bad stale=; a bad ::CALLOUT; a bad/misplaced ::MARKDOWN_STYLE, or one that conflicts with ::CALLOUT; a {{col}} naming no column or an unknown :fmt; TeX KaTeX can't parse; diagram pins on only some nodes; with --policy: what an access policy refuses or hides (access-control skill) |
unknown-cast | warning | ::BARCHAT: not a role and not a SQL type — the column lost its role |
submit/unknown-variable, submit/unsupported-input, submit/duplicate-input, submit/no-vars, submit/too-many-vars, submit/rows | error (submit/rows: warning at 0 rows) | #517 ::SUBMIT/::SUBMIT_VARS: a named variable no input declares, or from a ::DATERANGE/::PERIOD input, or declared by two inputs; no/too many (>32) recorded variables; the statement returns 0 (hidden by default) or >1 rows |
submit/dynamic-vars, submit/options-from-variable, state/markup-from-viewer | warning | ::SUBMIT_VARS isn't a plain string literal (can't be checked statically); a recorded input's own option query reads a viewer-settable variable; a ::MARKDOWN/::LINK/::DOWNLOAD_* column reads viewer_state.value (a learner's TEXT answer could carry markup/a link) |
state/shadowed | error | a dashboard's own CREATE TABLE/VIEW named viewer_state/viewer_state_latest — reserved for the server's per-viewer state (#517) |
show_if/not-alone, show_if/bad-target (error) · show_if/no-target, show_if/not-boolean, show_if/no-row, show_if/unknown-variable, show_if/constant (warning) | mostly warning, two are errors | a ::SHOW_IF column beside other roles (ignored, the panel shows); its target is ::TAB/::SUBTAB/::VIEW/::ENDVIEW/::ENDGROUP/::FIT/::COLUMNS/chrome/::RELOAD (always shows); nothing follows it; under the defaults used here the cell isn't a BOOLEAN, or there's no row (always hidden); its getvariable() names no variable this dashboard sets; it reads no variable at all |
step/inside-subtab, step/var-clash, step/gate-without-step (error) · step/mixed-with-subtab, step/lone, step/var-not-allowed, step/empty, step/fit-inside, step/gate-on-last, step/gate-not-boolean, step/gate-no-row, step/gate-constant, step/gate-unknown-variable, step/duplicate-label (warning) · step/computed-label (note) | mostly warning, three are errors | a ::GUIDE_STEP marker inside a ::SUBTAB (drawn as a plain heading instead); its variable also set by an input / SET VARIABLE / ::SELECT_AS / ::DRILL / ::ROWSELECT; ::GATE/::GATE_MESSAGE without ::GUIDE_STEP on the same statement; a ::SUBTAB closing an open sequence; a sequence with one step; the variable missing from a declared -- @vars; a step with nothing to show; ::FIT inside a step (ignored); a ::GATE on the last step (nothing to hold back); under the defaults used here the gate isn't a BOOLEAN, or there's no row (Next stays disabled); a gate that reads no variable, or a getvariable() this dashboard never sets; the same label on two steps; a computed (non-literal) step label |
tour/bad-id, tour/duplicate-id, tour/unknown-panel, tour/autostart-unknown (error) · tour/empty, tour/long-text, tour/too-many-steps, tour/too-many, tour/stray-step (warning) | mostly warning, four are errors | a -- @tour <id> that isn't a plain identifier, or reused by another tour; a step target that is neither page nor any -- @name; -- @tour_autostart naming no tour; a tour with no steps; a step's text over 400 characters; over 20 steps in one tour; over 10 tours on one dashboard; a -- target: text line right after some other header line with no -- @tour above it (likely mis-indented) |
design/untitled-chart, design/pie-slices, design/unsorted-bars, design/many-series, design/too-many-panels, design/ungrouped-kpis, design/ungrouped-inputs (note), design/raw-table, design/remote-view | warning | design advisories (below); --strict makes them fail, --no-design hides them. A deliberate exception for one statement: -- @lint_allow design/<code> directly above it |
layout/input-scope, layout/mixed-input-row, layout/filter-below-content (warning) · input/unused (note) | warning | an input stands away from what it controls (#949): inside one tab while it drives panels on several, or in a section none of its panels is in; one row of inputs (consecutive, or one ::GROUP) mixes a page or section filter with one panel's switch; an input filters a panel above it in its own section; no statement reads its variable. Follow Placing inputs below |
lint/allowed (note) · lint/allow-not-design, lint/allow-unused (warning) | note / warning | a design/* advisory allowed by -- @lint_allow (still listed, --strict passes); a -- @lint_allow code outside design/ (errors and other checks can't be allowed); one the statement doesn't trigger |
ask/include-state, ask/unknown-mark, ask/mark-unused | warning | -- @ask include opts a viewer_state panel into Ask (on a trainer's dashboard: every viewer's answers — aggregate, mask names); a -- @ask word other than skip / include / mask; a mark that does nothing (on setup, or include on a panel Ask reads anyway) |
--check gives each input a default (SET VARIABLE: the first option of a single input, every option of a ::MULTISELECT, both ends of a ::DATERANGE, the default period of a ::PERIOD), so filtered panels are checked with real data. Variables nothing sets (selected, a clicked table's key) are unset: guard them with COALESCE / NULLIF as in the master-detail example. --json prints {"ok": …, "diagnostics": [{"severity", "stmt", "code", "message", "sql"}]}.
dashboard --roles prints the authoritative list from the registry (src/roles.rs); dashboard --roles-md the table of docs/DOCS.md. Unknown casts are flagged by --check.
| Group | Roles (aliases in brackets) |
|---|---|
| Chart kind (on the measure) | ::BARCHART ::BARCHART_STACKED ::BARCHART_PERCENT ::BARCHART_STACKED_PERCENT · ::LINECHART ::LINECHART_PERCENT ::STEP ::SMOOTH · ::AREACHART ::AREACHART_STACKED · ::SCATTER ::BUBBLE ::JITTER · ::PIE ::DONUTCHART · ::GAUGE · ::RADAR · ::WATERFALL ::BULLET ::FUNNEL · ::HISTOGRAM ::DENSITY ::BOXPLOT ::VIOLIN ::QQ · ::HEATMAP ::CALENDAR · ::CANDLESTICK · ::SPARKLINE ::SPARKBAR · ::MAP (WKT) · ::REGION (a code from the built-in boundaries: 'DE'/'DEU', 'DE-BY', AGS '09162', NUTS 'DE212') · ::LAT + ::LON (points) · ::ORIGIN + ::DEST (flows: a code, WKT POINT, or {'lon','lat','name'} struct — width by ::SIZE) · ::BASEMAP (WKT or 'world', 'de-states', 'de-districts') · ::DIAGRAM (on the node id, see Diagrams) · ::SANKEY (flows between stages: ::ORIGIN → ::DEST, link width by the measure) · ::TREEMAP (part-to-whole tiles, area by the measure: ::XAXIS is the tile's key — what a click and ::DRILL read — and a ::LABEL shows a name instead, e.g. code 'DE-BY' shown as 'Bavaria'; ::CATEGORY nests tiles in groups) · ::PARETO (bars largest first + the cumulative share on a 0–100 % right axis) · ::GANTT (one bar per task from ::XMIN to ::XMAX) · ::DUMBBELL (two values per item joined by a line: ::XMIN → ::XMAX, before/after; the legend names both ends by their columns, a ::LABEL is written past each item) · ::RIDGELINE (one density per ::CATEGORY, stacked ridges) (a top N of a longer list: add (SELECT sum(v) FROM t)::PARETO_TOTAL so the line ends at its share of the total) |
| Encoding | ::XAXIS (::X) · ::YAXIS (::Y, heatmap rows) · ::CATEGORY (::SERIES, ::COLOR) discrete colour · ::LABEL (section heading alone; else chart / per-mark label) · ::TITLE (panel title bar) · ::SUBTITLE (a muted line under it) · 'hero'::CLASS (a class of the operator's stylesheet on the panel; the page prefixes ax-c-) · ::SIZE (bubble; on a map: a symbol's area, graduated — largest first, size legend) · ::BIVARIATE (a map's 2nd measure: tertiles of both, 3×3 palette and legend) · ::FRAME (a time map: one result holds every frame — a week, a date — with shared colours/classes/sizes across them; static output shows the last, named in the subtitle; the browser adds a Play/slider bar under the map; also on bar/line/area/scatter charts with an ::XAXIS, on axes fixed across every frame) · ::OPEN ::HIGH ::LOW (candles) |
Box plot from statistics (one row per box, no ::BOXPLOT) | ::Q1 ::MEDIAN ::Q3 (required) · ::WHISKER_LOW + ::WHISKER_HIGH · ::MEAN (a dot) · ::OUTLIERS (a list) · ::TARGET (::REFLINE) per row: a tick across that box — a promised lead time, a budget (max(promised_days)::TARGET; one marker per box, no ::SCATTER overlay) — e.g. quantile_cont(v, 0.25)::Q1, median(v)::MEDIAN, quantile_cont(v, 0.75)::Q3 with GROUP BY the ::XAXIS, for populations too large to send as raw rows |
::BOXPLOT / ::VIOLIN / ::JITTER x | the ::XAXIS is always discrete groups, one per distinct value — a VARCHAR stays discrete whatever the strings look like (ISO dates included), and a DATE/TIMESTAMP column groups by distinct day (same date formatting as the date axis elsewhere), never a continuous position |
| Intervals, facets | ::YMIN + ::YMAX (a ::SCATTER → pointrange, bars / lines → error bars, dodged by ::CATEGORY) · ::XMIN + ::XMAX · ::FACET / ::FACET_FREE + ::FACET_NCOL (cartesian charts, ::HISTOGRAM, ::QQ, ::HEATMAP — a heatmap's facet is one tile grid per value, shared colour scale; not yet pie/gauge/calendar/candlestick/radar/sparkline/waterfall/bullet/funnel; --check warns) · ::RANK + ::LABEL_TOP · ::CENSOR (Kaplan-Meier +) |
| Annotations | ::REFLINE (::YLINE, ::TARGET; several ::REFLINE columns each draw their own line(s) — e.g. an alert band's lower and upper edge) · ::XLINE (number, date or timestamp) · ::BAND_LOWER + ::BAND_UPPER (several pairs, in column order = a nested fan: 95 / 80 / 50 %) · CASE WHEN flag THEN day END::MARKAREA (a shaded region per run of flagged days) · ::DATALABELS · 'slope,intercept'::ABLINE · 1::IDENTITY · p::COOKS_CONTOUR |
Annotations from data (per row — LEFT JOIN events ON events.day = t.day) | ::XLINE + ::XLINE_LABEL (labelled event line) · ::XBAND_FROM + ::XBAND_TO + ::XBAND_LABEL (labelled shaded range) · ::REFLINE + ::REFLINE_LABEL (one ::REFLINE_LABEL column labels every ::REFLINE column; several label columns pair with them in column order) · ::ANNOTATE (text callout at the row's x, y; NULL = none) |
| Thresholds | '<0:bad; <5:warn; good'::THRESHOLDS beside a KPI (value colour), a ::GAUGE (zones) or a chart (threshold lines) · alone before a table: 'Margin %: <10:bad; good | accuracy: <0.85:bad'::THRESHOLDS (cell tint + ● ▲ ◆) · first match wins; value's own units |
| Modifiers | 1::FLIP · '€'::YFORMAT / ::XFORMAT ('$', an ISO code 'CHF', 'percent', 'comma', ' kg'; on a date x a strftime pattern like '%H:%M', '%-d %b' or '%b %Y') · 'log10' | 'sqrt' | 'reverse'::XSCALE / ::YSCALE (log/sqrt ticks land on round numbers, e.g. 1/10/100, not half-decades or squares) · '100,1000,10000'::XBREAKS / ::YBREAKS (explicit tick positions, in data units; overrides the automatic ticks; cartesian charts only) · 'lm' | 'gam' | 'loess'::SMOOTH_METHOD · 0::SIGN_SPLIT (one line / area / ::DENSITY red below the threshold, green above, cut at the crossing — losses vs gains, below vs above target; 'y 85; below:warn' sets axis, threshold and colours; a density splits along x) · 0.6::ALPHA (a map layer's or a scatter's points' opacity — dense scatters) · 'none' | 'top' | 'right' | 'bottom' | 'left'::LEGEND (hide / move a chart's legend or colourbar; any chart with one — categorised bar/line/area/scatter, ::HEATMAP, pie/donut, maps) · 'Residual load (GW)'::XTITLE / ::YTITLE (axis titles: say what the axes are instead of packing it into ::TITLE) · 'margin_pct'::Y2 (that measure column on a right-hand axis of its own — revenue bars with a margin line; in the chart's own SELECT, next to both measures) + 'percent'::Y2FORMAT · 'on'::MAPTILES (the installation's tile basemap under a map; needs 'mercator'::PROJECTION and a server with options.basemap) · 'routes'::SYNC_ZOOM (maps with the same value zoom together) · 'weeks'::SYNC_FRAME (time maps with the same value step and play together) · map 'auto'::PROJECTION ('equal-earth', 'conic', 'utm', 'mercator', 'none' for planar x/y), 'quantile 5'::CLASSES ('jenks 5', 'equal 5', '0,10,50' — a map's colour classes; unrelated to ::HIST_BINS below, despite the shared ::BINS alias), 0::MIDPOINT, 'lo,hi'::RANGE, 'de-districts'::BOUNDARIES (force the layer), 'auto'::HEXBIN ('25 km') on point maps, 8::LABEL_TOP / ''::DATALABELS (region names on the map) · gauge '0,100'::RANGE, '#a,#b'::COLORS, 'low,high'::LABELS · ::HISTOGRAM only: '20'::HIST_BINS (bin count) or '0,10,20,30'::HIST_BINS (explicit edges), shared across every ::CATEGORY/::FACET group; 'share'::HIST_NORM normalises each group to its own share of 1 (reference/current periods of unequal size stay comparable); ::CATEGORY draws one overlaid series per group with alpha (no dodge role yet) |
| KPI and text | ::METRIC · ::MONEY (the currency follows ::LOCALE; another one: 'EUR'::CURRENCY_CODE beside it, in the same SELECT) · ::PERCENT (the value in percent, 0–100: 12.5 → 12.5%; a fraction × 100 — also 'percent'::YFORMAT and {{x:percent}}) · ::COMPACT (1.2K) · ::DELTA (comparison → arrow + %, up = green) · ::DELTA_LOWER_GOOD (the same, but a rise is red: churn, cost, errors) · ::DELTA_FORMAT ('pct'/'abs'/'both': ▲ 12% (+$1,200), +2.3 pp for a ::PERCENT) · ::DELTA_LABEL ('vs last month', getvariable('p_prev_label')) · in a KPI: list(v ORDER BY d)::SPARKLINE (trend line), ::GOAL (progress bar) · 'compact'::KPI_SIZE on a KPI or a ::GROUP (every tile in it, unless a tile overrides): one line — label, value, change — ~36 px, no ::SPARKLINE/::GOAL; a status row of 4–6 next to ::BUTTONS · ::TEXT_SMALL / ::TEXT_MEDIUM / ::TEXT_LARGE · ::MARKDOWN · 'warning'::CALLOUT beside a ::MARKDOWN (note / warning / success box) · 'plain'::MARKDOWN_STYLE beside a ::MARKDOWN (#536: text on the page background, no card/tint/bar — for prose on a methodology tab or detail pane; 'card' = a plain white card like a chart panel; 'callout' = today's tinted box, the default, and what ::CALLOUT already implies; 'caption' right after a chart = that chart card's footer, for a source note or "how to read this" — no box of its own; a dashboard-wide default comes from `-- @markdown_style <plain |
| Tables | ::TABLE (one marker per panel) · ::PAGED (SQL-paginated) · per column ::MONEY ::PERCENT ::COMPACT ::METRIC ::TREND ::COLORSCALE (low = good) ::COLORSCALE_HIGH_GOOD ::COLORSCALE_DIVERGING (around 0) ::BADGE ::SPARKLINE (a list() column) ::SPARKBAR (a list() column, or two overlaid series from list({'ref','cur'})) ::PLAIN · ::PVALUE (< 0.001, else three decimals) · ::SCIENTIFIC (1.23e−5) · ::DOWNLOAD_CSV / ::DOWNLOAD_XLSX / ::DOWNLOAD_PDF / ::DOWNLOAD_JSON · ::RECORD (instead of ::TABLE: one record as key/value pairs — a STRUCT / MAP / JSON object's fields, or the first row's columns) |
| Table directives (before the table) | 'none' | 'single' | 'multi'::ROWSELECT · 'sum'::TOTALS (::TOTAL) · 'A: x, y | B: z'::COLGROUP · 'mape > 0.2'::FLAG · 'Revenue: top 3'::HIGHLIGHT (::TOPN) · 'region'::SUBTOTAL · 'none' | 'search,filters,totals,stats,columns,density,export'::TOOLBAR (drop the toolbar on a tiny table) — see Tables |
| Chart interactions (before the chart) | 'region' | 'region multi'::SELECT_AS (own selection variable + brushed region_from / region_to) · 'region > country > city'::DRILL (drill-down + breadcrumb) · a '#Tab?v.x={value}'::LINK column (drill-through, charts and tables) |
| Inputs | ::DROPDOWN (a searchable combobox above ~50 options, like ::MULTISELECT; 'search'/'native'::DROPDOWN_STYLE overrides) · ::SCENARIO (a ::DROPDOWN of anofox-scenario branches, SELECT name AS scenario ::SCENARIO FROM anofox_scenarios(); on a locked server with options.scenarios unqualified tables read the picked one; compare with anofox_scenario_rows('plan') / anofox_scenario_diff('s', 'plan')) · ::MULTISELECT (a list) · ::BUTTONS (segmented, ≤ ~5 options) · ::TOGGLE (a BOOLEAN; value = default) · ::NUMBER · ::DATE · ::TEXT · ::DATERANGE (two columns → from / to) · ::PERIOD (presets + grain + comparison) · ::HINT · ::OPTION_LABEL (an option's shown text; the value stays the variable's) · ::DEFAULT (true on the default option(s), e.g. w = '7 days' AS d ::DEFAULT; keeps the options in their natural order) · field AS lt ::FORM, type, value, options, min, max, step, label, unit, help, show_if, source (#683: a form from rows, one per field — e.g. the clicked node's parameters; ONE variable holding a JSON object: (getvariable('lt')->>'mean')::DOUBLE; types number/slider/dropdown/toggle/date/text/preset/distribution (#1235: a prior or uncertain input — value 'Beta(2, 3)' or {"family": "Gamma", "shape": 12, "rate": 1}, families via options; the viewer types the parameters or a likely value + 90 % range; read getvariable('pr')->'share'->>'a'); show_if 'model=normal', 'capex=true & fin=loan'; long forms (#1233): section + 'tabs'/'accordion'/'list' ::FORM_LAYOUT and ::TITLE/::SUBTITLE as columns of the form's statement, advanced (under "More"), width 'half', a preset row whose options is a JSON object {"Flat": {"use_kwh": 2000}}; values are viewer input — cast/clamp in SQL) |
| Recording a viewer's answers (#517) | 'Check my answers' AS quiz_1::SUBMIT, 'q1, note'::SUBMIT_VARS, 'Saved.'::SUBMIT_DONE — a button; its statement runs as the viewer (one row = available, zero = hidden, several = error); SUBMIT_VARS names input-declared variables (not ::DATERANGE/::PERIOD) to record, append-only. Reads back with viewer_state/viewer_state_latest (own rows; every viewer's, for a named trainer). Requires a locked server with options.state naming this dashboard — disabled, with a visible reason, on a published static site, a server without options.state, or the wasm/live-authoring builder's own preview (which appends to an in-tab viewer_state instead, never reaching a server). See docs/secure-serving.md → "Per-viewer state" for the full contract, limits and threat model, and dashboard state export|erase for retention/erasure. |
| Strips under a chart | right after a chart with a numeric / date x: day::XAXIS, 'Promotions'::TRACK, name::LABEL (ticks) · … , detector::YAXIS, '#d64545'-style ::CATEGORY, 1::HEATMAP, 'Alarms'::TRACK (lanes of tiles) · day::XAXIS, price::STEP, 'Price'::TRACK (sparkline) — same plot area and x window as the chart; a click on a strip mark shades its span on the chart |
| Layout and chrome | n::COLUMNS · n::COL (::SPAN, ::WIDTH; of 12) · n::HEIGHT (px) · 'Box'::GROUP … 1::ENDGROUP · `'Title'::FIGURE, '(hist / scatter) |
| Theme, branding, locale | 'dark'::THEME (light dark print colorblind high-contrast, a stack 'acme+dark', or JSON: content::THEME FROM read_text('acme.json')) · 'de-DE'::LOCALE (en-US en-GB en-IE (English, €) de-DE fr-FR; the locale sets the marks and the default currency — amounts in another currency take 'EUR'::CURRENCY_CODE on their panel) · 'Title'::DASHBOARD_TITLE · 'ACME'::BRAND · 'logo.svg'::LOGO · 'favicon.svg'::FAVICON · max(loaded_at)::ASOF, 'stale=24h' (a "Data as of …" chip, amber when stale — give every locked / exported dashboard one; a plain DATE reads as a calendar day, with no time and no time-zone shift) |
A combo chart is several measure columns: week::XAXIS, sales::BARCHART, revenue / 50::LINECHART. A ::ROLE may follow an AS alias, or come right before it (sum(x)::BARCHART AS "Revenue" reads as sum(x) AS "Revenue" ::BARCHART): for a measure the alias is the legend name (else the bare column name), for an input it is the variable name, in a table the header. Without a ::CATEGORY, several columns of the same chart kind (events::LINECHART, failures::LINECHART; events::BARCHART, failures::BARCHART) get a real legend named by column (several measures of one bar kind are its series, as with a ::CATEGORY: h AS "Holding" ::BARCHART_STACKED, b AS "Backlog" ::BARCHART_STACKED stacks them, two ::BARCHART columns sit side by side, the percent kinds stack to 100 %); a mixed overlay (bars + a different-kind line/area) instead keeps the base in the brand colour with no legend, each overlay just a distinct palette colour.
Placing inputs (#949): put an input where what it controls is. A filter that every tab reads goes above the first ::TAB, in one 'Filters'::GROUP … ::ENDGROUP bar (time first — ::PERIOD / ::DATERANGE —, then place, then product or customer, then measure switches; at most ~4 in a row). A filter for one tab goes at the top of that tab. A switch for one chart (a metric ::BUTTONS, a top-N) goes directly above that chart, never in the filter bar. Inputs come before the panels they drive. Don't put a page filter and a one-chart switch side by side; don't add an input nothing reads (--check names each case). Or let the page do it: -- @inputs auto in the header places each loose input (not one in a ::GROUP) by what reads it — the page's filter bar above the tabs, the top of its one tab, or its one chart's title — in that fixed order; then write inputs anywhere, e.g. each next to the panels that use it.
The output column name of an input is a DuckDB variable: SELECT region AS region ::DROPDOWN FROM t GROUP BY 1 ORDER BY 1; → getvariable('region'). A ::DROPDOWN / ::BUTTONS starts on its first option, one option per row. An "All" option: SELECT r AS region ::DROPDOWN, r = 'All' ::DEFAULT FROM (SELECT 'All' AS r UNION ALL SELECT DISTINCT region FROM t) ORDER BY r <> 'All', r; and WHERE getvariable('region') IN ('All', region) in every panel it filters (never a list(…) as the option: --check → input/list-option). A ::MULTISELECT is a list: list_contains(getvariable('channel'), channel); "nothing selected = all": (len(getvariable('channel')) = 0 OR list_contains(getvariable('channel'), channel)).
Metric / dimension switcher: a ::BUTTONS input picks the view, the chart reads it — measure: CASE getvariable('metric') WHEN 'Revenue' THEN sum(revenue) WHEN 'Units' THEN sum(units) END::BARCHART; grouping column: COLUMNS(getvariable('dim'))::XAXIS (options = real column names). A ::TOGGLE is a BOOLEAN: WHERE NOT getvariable('net') OR ….
An input's caption is its variable name unless a ::LABEL column gives one: SELECT 50 AS refund_at_pct ::NUMBER, 'Refund threshold (%)'::LABEL;.
Named chart selections: SELECT 'region'::SELECT_AS; before a chart makes its click set getvariable('region') ('' = none) instead of selected; 'region multi' keeps a VARCHAR[] ([] = none; shift/ctrl-click adds). A toolbox brush on a continuous/date x sets region_from / region_to (NULL = none; dates as text → ::DATE). Guards: getvariable('region') IN ('', region), len(getvariable('region')) = 0 OR list_contains(getvariable('region'), region), d BETWEEN coalesce(getvariable('week_from')::DATE, d) AND coalesce(getvariable('week_to')::DATE, d). Use it whenever two charts should filter independently.
Drill-down: SELECT 'region > country > city'::DRILL; before a chart → a click goes one level deeper, a breadcrumb goes back. The chart's x is CASE getvariable('drill_level') WHEN 'region' THEN region WHEN 'country' THEN country ELSE city END, filtered by getvariable('region') IN ('', region) AND getvariable('country') IN ('', country) (each level variable is '' until drilled past; also drill_depth, drill_path; 'geo: …' renames the prefix). Drill-through: a ::LINK column holds a template — '#Tab?v.x={value}' (tab + variables), '/d/<id>?v.x={value}' (another served dashboard), 'https://…/{value}' (new browser tab); {value} = the clicked key, {column} = a column of the clicked row (a table row, or a scatter point's own row), {label} = its ::LABEL. In a table it renders as a link cell.
The URL is the view: ?tab=<name> opens a tab, ?v.<name>=<value> seeds a variable (an input — only a valid option / number / date —, selected, or a named selection; repeat the key for a list: ?v.channel=app&v.channel=web). The address bar follows every change and Share includes it, so a link restores the exact view; use it to link one dashboard to another pre-filtered.
Cross-filter: a click on a chart mark sets getvariable('selected'). Table rows are clickable only when the table opts in ('none' is the default) with a ::ROWSELECT directive before it: SELECT 'single'::ROWSELECT; (a click sets getvariable('selected') and getvariable('<first column>')) or SELECT 'multi'::ROWSELECT; (rows get check marks; getvariable('<first column>') is a list — guard with len(COALESCE(getvariable('sku'), []::VARCHAR[])) = 0 OR list_contains(getvariable('sku'), sku)). Without it rows are not selectable. Panels opt in: WHERE COALESCE(getvariable('selected'), '') IN ('', channel) ('' = nothing clicked; the browser starts with '', --check and serve with the variable unset, so keep the COALESCE). Sources (comparison charts) should not filter themselves; targets do. Put the key column first in a table.
Period vs previous period — use one ::PERIOD, never hand-written date math. The alias is the variable prefix:
SELECT 'presets=7d,30d,90d,mtd,qtd,ytd,last_month; default=30d; compare=prev' AS p ::PERIOD, 'Period'::LABEL;
CREATE OR REPLACE MACRO in_period(d) AS d BETWEEN getvariable('p_from')::DATE AND getvariable('p_to')::DATE;
CREATE OR REPLACE MACRO in_prev(d) AS d BETWEEN getvariable('p_prev_from')::DATE AND getvariable('p_prev_to')::DATE;
SELECT sum(revenue) FILTER (WHERE in_period(day))::MONEY, sum(revenue) FILTER (WHERE in_prev(day))::DELTA, 'Revenue'::LABEL FROM orders;
SELECT date_trunc(getvariable('p_grain'), day)::DATE ::XAXIS, sum(revenue)::LINECHART, 'Revenue'::TITLE FROM orders WHERE in_period(day) GROUP BY ALL ORDER BY 1;
Variables (text): p_from, p_to, p_prev_from, p_prev_to (NULL with "No comparison"), p_grain (day/week/month/quarter), p_compare (none/prev/yoy), p_label ("Sep 2026"), p_prev_label ("vs Aug 2026"). Spec keys: presets (Nd, Nw, Nm, today, yesterday, wtd, mtd, qtd, ytd, last_week, last_month, last_quarter, last_year), default, from/to, grain (auto), grains (none hides the switch), compare (prev/yoy/none), today (pin it for fixed sample data). Bad specs → period/bad-spec.
KPI tile with change, trend and goal (one statement; NULL comparison → no change line):
SELECT sum(rev) FILTER (WHERE cur)::MONEY, sum(rev) FILTER (WHERE prev)::DELTA, 'both'::DELTA_FORMAT,
getvariable('p_prev_label')::DELTA_LABEL, list(rev ORDER BY b) FILTER (WHERE cur)::SPARKLINE,
750000::GOAL, 'Revenue'::LABEL
FROM (SELECT date_trunc(getvariable('p_grain'), day) AS b, in_period(day) AS cur, coalesce(in_prev(day), false) AS prev,
sum(revenue) AS rev FROM orders GROUP BY ALL);
Lint: kpi/bad-delta-format, kpi/no-delta, kpi/sparkline-not-list.
Inputs, tabs, downloads and cross-filter work in the browser builder and serve; the static dashboard file.sql render draws no controls but binds each input's default.
A ::TABLE / ::PAGED panel has a toolbar the viewer drives: row count with filter chips, search, Filters (a dropdown / > n < n range / "contains" under each header), Σ Totals (over every matching row; each total has a "sum ▾" menu: sum, mean, median, min, max, count), Columns (show / hide), Pages | Scroll (virtualised), Stats (a strip under the header: histogram per number column, top 3 values per text column), Compact | Comfortable density and ⤓ Export (CSV of the raw values, or an Excel .xlsx formatted like the table: units, number formats, live subtotal / total formulas). Hovering a header shows min / max / mean, empty and distinct counts.
Formatting is automatic, so do not pre-format numbers as text: raw names become headers (load_pct → "Load %", avg_mae → "Avg MAE"; an AS "Header" alias is kept), each numeric column gets its own decimals and grouping (ids and years ungrouped), a true minus, muted zeros, "—" for NULL, ✓ / ✗ for booleans, and one unit per ::MONEY / ::COMPACT column moved into the header ("Revenue ($M)"). Plain numeric columns get a slim in-cell bar (::PLAIN turns it off).
Directives for the next table (columns named by raw name or header, case-insensitive):
| Directive | Value | Effect |
|---|---|---|
::ROWSELECT | 'none' (default) | 'single' | 'multi' | row click → getvariable('<first column>') (+ 'selected' for single); multi = a list |
::TOTALS | 'sum' | 'mean' | 'median' | 'min' | 'max' | 'count' | 'none', or 'revenue: sum; per 10k: none' (; or ,) | totals aggregation (default: sums of amounts / counts, no total for rates and percentages, means of the rest; name distances: 'km: mean'); 'none' hides the row |
::COLGROUP | 'Money: plan, revenue | Quality: accuracy, bias' | a grouped header over adjacent columns |
::FLAG | 'margin < 12, status = breach' (> >= < <= = !=) | ⚠ + warning tint on matching cells |
::HIGHLIGHT | 'revenue: top 2, margin: bottom 1' ('top 3' = first numeric column) | bold + rank on the top / bottom n (a ::PAGED table: within the page) |
::SUBTOTAL | 'region' | rows grouped by that column, a subtotal row after each group (each column's total aggregation); ::TABLE only, not ::PAGED |
::TOOLBAR | 'none', or an allow-list of parts to keep — 'search,filters,totals,stats,columns,density,export' | 'none': drop the whole toolbar — row count and filter chips too (a tiny lookup table that can never need paging, search or column tricks); a ::ROWSELECT 'multi' table with an active selection keeps just its "N selected" chip. Otherwise keep only the named parts; each kept part still needs its own usual row/column threshold (e.g. 'filters' on a 3-row table still shows no Filters button). 'totals' only hides its toggle button — the totals row still follows ::TOTALS / the automatic default either way. 'density' covers Pages|Scroll too, not just Compact|Comfortable. No ::TOOLBAR at all: every part shows, at its usual threshold — unchanged. Excluding 'export' (or 'none') still gets a small hover ⤓ CSV button (exporting the same matching/sorted/visible rows as the toolbar's own would); add ::DOWNLOAD_CSV / _XLSX / _PDF for a bigger, explicit export button beside it |
CREATE TABLE regions AS SELECT * FROM (VALUES
('North', 1200, 1350.5, 18.2, 0.91, 2.5), ('South', 1100, 980.0, 9.5, 0.84, -4.1),
('West', 800, 860.25, 14.0, 0.88, 0.0), ('East', 950, 1010.0, 11.3, 0.79, -1.2)) t(region, plan, revenue, margin, accuracy, bias);
SELECT 'single'::ROWSELECT;
SELECT 'revenue: sum, margin: mean, accuracy: median'::TOTALS;
SELECT 'Money: plan, revenue | Quality: accuracy, bias'::COLGROUP;
SELECT 'margin < 12'::FLAG;
SELECT 'revenue: top 2'::HIGHLIGHT;
SELECT region::TABLE, plan::MONEY, revenue::MONEY, margin,
accuracy::COLORSCALE_HIGH_GOOD, bias::COLORSCALE_DIVERGING,
'Revenue against plan by region'::TITLE
FROM regions ORDER BY revenue DESC;
SELECT sum(revenue)::MONEY, 'Revenue of the clicked region'::LABEL FROM regions
WHERE COALESCE(getvariable('region'), '') IN ('', region);
::PAGED runs everything in DuckDB — page, sort, search, column filters, totals, column statistics and filter values — so it suits Parquet on S3, MotherDuck or a served database; ::TABLE loads the whole result (up to ~10k rows). A theme's chrome.negatives ("minus" default, "red", "parens") and chrome.zero ("muted" default, "dash") set how tables show negatives and zeros.
A couple of rows and columns next to a chart never need the full toolbar — it only reads as "this is a big dataset":
SELECT 'none'::TOOLBAR;
SELECT name::TABLE, value FROM (VALUES ('Alpha', 1), ('Beta', 2)) AS t(name, value);
x::XAXIS, y::YAXIS, value::HEATMAP (+ '$'::YFORMAT, ''::DATALABELS to print values in the cells). Text axes keep the SQL row order — the first ::YAXIS level is the top row, so ORDER BY the rows you want first. Colour is the theme's sequential ramp; values spanning zero switch to its diverging ramp around 0. When a value is good or bad, colour by status instead: ''::COLORSCALE (continuous green → yellow → red, low = good; ::COLORSCALE_HIGH_GOOD, ::COLORSCALE_DIVERGING) or '>=50:bad; >=20:warn; good'::THRESHOLDS (one status colour per band, stepped legend ≥ 50% / 20%–50% / < 20%; reuse the rules of the tab's KPIs / table so the colours agree; rules in the values' unit — percent vs fraction). Theme status colours, safe in dark mode and the colour-blind theme; also on ::CALENDAR and ::TRACK tiles. Cells part with card-coloured gaps; labels flip dark / light for contrast. Tooltip, labels and legend use ::YFORMAT and the locale. A click cross-filters: getvariable('selected') = the cell's row (::YAXIS) value. 'none'::LEGEND drops the colourbar on a dense dashboard where the tooltip already gives the value ('top'/'right'/'bottom'/'left' move it instead). ::FACET / ::FACET_FREE draws one tile grid per distinct value (reference vs. current, a confusion matrix per period) with a shared colour scale/legend across every panel. A ::XAXIS/::YAXIS column's SQL type decides its axis, not whether its values happen to look like numbers — a VARCHAR column of '0'/'1' class labels stays discrete, same as 'cat'/'dog'. ::IDENTITY/::REFLINE are still dropped on a ::HEATMAP (--check warns).
Chart tooltips and ::DATALABELS everywhere follow ::YFORMAT / ::XFORMAT and the ::LOCALE ($1,234.50, 1.234,50 €); percent charts read as percent.
One theme styles the whole dashboard — charts, cards, tabs, KPI tiles, tables, inputs, tooltips — in every output (browser, serve, locked pages, dashboard HTML / --svg, exports). Directives are dashboard-level: put them at the top; the last one of each kind wins.
SELECT 'Sales cockpit'::DASHBOARD_TITLE;
SELECT 'ACME Analytics'::BRAND;
SELECT 'colorblind+dark'::THEME; -- Okabe-Ito palette; dark when the viewer prefers dark
SELECT 'de-DE'::LOCALE; -- 1.234,5 · 12.400 € · 12,5 % · Okt. 2026
CREATE OR REPLACE TABLE sales AS SELECT * FROM (VALUES
('North', 1200.5), ('South', 950.25), ('West', 610.0)) t(region, revenue);
SELECT 'Revenue'::SECTION;
SELECT 'Totals'::GROUP;
SELECT sum(revenue)::MONEY, 'Revenue'::LABEL FROM sales;
SELECT count(*)::METRIC, 'Regions'::LABEL FROM sales;
SELECT 1::ENDGROUP;
SELECT region::XAXIS, sum(revenue)::BARCHART, 'Revenue by region'::TITLE
FROM sales GROUP BY ALL ORDER BY 2 DESC;
light (aliases default, datazoo). colorblind (Okabe-Ito palette) is a built-in theme too, never implied.::THEME, or 'x+dark', follows the viewer (OS setting, the 🌙 toggle, ?theme=dark); 'light' / 'dark' / 'print' alone pin it. Charts are re-rendered dark, not just the cards.{"extends":"light","palette":[…],"colors":{"accent":"#0b5fff",…},"chrome":{"negatives":"parens","zero":"dash",…},"brand":{…},"dark":{…}}) — from a file (SELECT content::THEME FROM read_text('acme.json')), a table (SELECT to_json(t)::THEME FROM themes t WHERE name = 'acme') or inline. Colours must be #rrggbb; unknown keys are an error. Full key list: docs/DOCS.md → Themes.SELECT sum(amount_eur)::MONEY, 'Revenue'::LABEL, 'EUR'::CURRENCY_CODE FROM sales; → €889,560; the same on a ::TABLE (its ::MONEY columns) or a chart (its y axis, when it has no ::YFORMAT). One code per panel, beside the value — a statement of its own formats nothing.dashboard --check reports theme/unknown, theme/multiple, locale/unknown, currency/unknown, currency/alone, period/bad-spec, kpi/bad-delta-format, kpi/no-delta, kpi/sparkline-not-list, chrome/bad-url (logos: relative, https: or data:image/).interaction/bad-value (a malformed ::SELECT_AS / ::DRILL value), interaction/name-clash (an input, a ::SELECT_AS and a ::DRILL level writing the same variable — rename one), interaction/rowselect-shared-name (two ::ROWSELECT tables whose first column ends up with the same name — a click in either toggles both) and link/bad-url (a ::LINK that is not #tab, ?…, a path or http(s)); it primes ::SELECT_AS / ::DRILL variables to "nothing selected / top level" like the browser. When the sharing is deliberate (several registers fanning in to one detail panel, or a dropdown and a ::ROWSELECT meant to hand a selection to each other), put -- @shared <name> directly above the ::ROWSELECT / ::SELECT_AS / ::DRILL / input statement that would otherwise be flagged — --check --strict then skips both lints for just that name, everything else still checked. A -- @shared name the statement doesn't itself set (a typo) is flagged on its own: interaction/shared-unused.dashboard --themes lists the built-ins; dashboard file.sql --theme dark / serve … --theme T set a default the script's ::THEME overrides.-- @name <name> directly above any statement that draws something (a panel, an input, a ::GROUP box, a ::TAB/::SUBTAB button, a ::VIEW switcher, a ::LABEL/::SECTION heading) tags its element data-dp-name="<name>" — a stable e2e selector and a guided tour's target (-- @tour, below). name matches ^[A-Za-z_][A-Za-z0-9_-]{0,63}$, unique per dashboard; page is reserved. --check reports name/bad, name/reserved, name/duplicate (errors) and name/not-drawn (a name on setup or an invisible directive).anofox_plot_* calls (statistics-plots skill) are panels too: the planner rewrites SELECT anofox_plot_terms(t, …), 'Title'::TITLE FROM producer(…) t to to_json(list(t)) and draws it with the same renderer, so the panel works in the browser builder (DuckDB-Wasm, no extension needed) and with dashboard / serve. Extra unannotated columns (SELECT method, anofox_plot_tests(t) … GROUP BY method) give one panel per result row. width := / height := are ignored (the layout sizes panels).
-- Weekly revenue and sessions, KPIs, filterable by channel
CREATE TABLE sales AS
SELECT 'W' || lpad((w + 1)::VARCHAR, 2, '0') AS week, c.channel,
(40 + 9 * w + 7 * c.k + (hash(w, c.channel) % 15)::INTEGER) AS n,
round((40 + 9 * w + 7 * c.k) * c.price, 2) AS revenue
FROM range(12) r(w), (VALUES ('app', 1, 2.5), ('web', 2, 3.1), ('store', 3, 4.0)) c(channel, k, price);
SELECT 'Filter'::GROUP;
SELECT DISTINCT channel::MULTISELECT FROM sales ORDER BY channel;
SELECT 1::ENDGROUP;
SELECT 'Weekly performance'::GROUP;
SELECT sum(revenue)::MONEY, 'Revenue'::LABEL FROM sales
WHERE list_contains(getvariable('channel'), channel);
SELECT sum(n)::COMPACT, 'Sessions'::LABEL FROM sales
WHERE list_contains(getvariable('channel'), channel);
SELECT 1::ENDGROUP;
SELECT 12::COL;
SELECT week::XAXIS, channel::CATEGORY, sum(revenue)::BARCHART_STACKED, '€'::YFORMAT,
'Revenue grows every week'::TITLE
FROM sales WHERE list_contains(getvariable('channel'), channel)
GROUP BY ALL ORDER BY week, channel;
-- Cross-filter: click a channel bar, the trend narrows to it
CREATE TABLE sessions AS SELECT * FROM (VALUES
('W1', 'app', 30), ('W1', 'web', 22), ('W2', 'app', 41), ('W2', 'web', 28), ('W3', 'app', 38), ('W3', 'web', 35)) t(week, channel, n);
SELECT channel::XAXIS, sum(n)::BARCHART, 'App brings most sessions (click a bar)'::TITLE
FROM sessions GROUP BY channel ORDER BY 2 DESC;
SELECT week::XAXIS, sum(n)::LINECHART, 'Sessions per week'::TITLE
FROM sessions WHERE COALESCE(getvariable('selected'), '') IN ('', channel)
GROUP BY ALL ORDER BY week;
-- A gauge of goal completion and a donut of spend by category
CREATE TABLE tasks AS SELECT 72 AS done;
CREATE TABLE expenses AS SELECT * FROM (VALUES ('rent', 1200), ('travel', 400), ('tools', 250)) t(category, spend);
SELECT 6::COL;
SELECT sum(done)::GAUGE, '0,100'::RANGE, '#e03131,#efc94c,#0ca678'::COLORS, 'Completion at 72%'::TITLE FROM tasks;
SELECT 6::COL;
SELECT category::CATEGORY, sum(spend)::DONUTCHART, 'Rent is two thirds of spend'::TITLE FROM expenses GROUP BY ALL ORDER BY 2 DESC;
-- Master-detail: click a SKU row, plot its monthly series
CREATE TABLE ts AS
SELECT 'SKU-' || s AS sku, DATE '2024-01-01' + to_months(m::INTEGER) AS month,
(20 * s + 3 * m + (hash(s, m) % 9)::INTEGER) AS sales
FROM range(1, 6) a(s), range(12) b(m);
SELECT 5::COL;
SELECT 'single'::ROWSELECT;
SELECT sku AS "SKU" ::TABLE, sum(sales) AS "Total" FROM ts GROUP BY sku ORDER BY "Total" DESC;
SELECT 7::COL;
SELECT month::XAXIS, sales::LINECHART, 'Monthly sales of the selected SKU'::TITLE FROM ts
WHERE sku = COALESCE(NULLIF(getvariable('SKU'), ''),
(SELECT sku FROM ts GROUP BY sku ORDER BY sum(sales) DESC LIMIT 1))
ORDER BY month;
-- Model output from roles: coefficient forest, residuals with a GAM trend
CREATE TABLE coefs AS SELECT * FROM (VALUES
('area', 'ols', 3.3, 2.9, 3.7), ('area', 'huber', 3.1, 2.8, 3.4),
('age', 'ols', -0.9, -1.4, -0.4), ('age', 'huber', -0.8, -1.2, -0.4)) t(term, model_id, estimate, conf_low, conf_high);
CREATE TABLE fit AS SELECT i AS row_id, i::DOUBLE AS fitted, sin(i / 3.0) + (i % 5 - 2) / 4.0 AS residual,
abs(sin(i / 7.0)) / 4 AS cooks_d FROM range(1, 60) r(i);
SELECT term::XAXIS, model_id::CATEGORY, estimate::SCATTER, conf_low::YMIN, conf_high::YMAX,
1::FLIP, 0::REFLINE, 'Area raises the price, age lowers it'::TITLE FROM coefs;
SELECT fitted::XAXIS, residual::SMOOTH, 'gam'::SMOOTH_METHOD, 0::REFLINE,
row_id::LABEL, 3::LABEL_TOP, cooks_d::RANK, 'Residuals vs fitted'::TITLE FROM fit;
-- Tabs, a 2-up row with equal heights, a formatted detail table
CREATE TABLE orders AS
SELECT DATE '2024-01-01' + INTERVAL (i) DAY AS day, (ARRAY['EU', 'US', 'APAC'])[1 + i % 3] AS region,
100 + (hash(i) % 50)::INTEGER AS amount, (i % 7 = 0) AS late
FROM range(90) r(i);
SELECT 'Overview'::TAB;
SELECT 6::COL; SELECT 320::HEIGHT;
SELECT region::XAXIS, sum(amount)::BARCHART, 'EU leads on revenue'::TITLE FROM orders GROUP BY 1 ORDER BY 2 DESC;
SELECT 6::COL; SELECT 320::HEIGHT;
SELECT amount::HISTOGRAM, 'Order values cluster at 100–150'::TITLE FROM orders;
SELECT 'Detail'::TAB;
SELECT region AS "Region" ::TABLE, sum(amount) AS "Revenue" ::MONEY,
round(100 * avg(late::INTEGER), 1) AS "Late share" ::PERCENT, list(amount ORDER BY day) AS "Trend" ::SPARKLINE,
list(amount ORDER BY day) AS "By day" ::SPARKBAR,
'Revenue by region'::TITLE
FROM orders GROUP BY region ORDER BY "Revenue" DESC;
-- Will we run out of stock before Christmas? (history, nested fan from Today, events, strip, story)
CREATE TABLE outlook AS
SELECT DATE '2026-11-01' + INTERVAL (i) DAY AS day,
CASE WHEN i <= 20 THEN 'Actual' ELSE 'Forecast' END AS series,
400 - 9 * i + CASE WHEN i <= 20 THEN (hash(i) % 15)::INTEGER ELSE 0 END AS units,
CASE WHEN i > 20 THEN 400 - 9 * i - 3 * (i - 20) END AS lo95, CASE WHEN i > 20 THEN 400 - 9 * i + 3 * (i - 20) END AS hi95,
CASE WHEN i > 20 THEN 400 - 9 * i - (i - 20) END AS lo50, CASE WHEN i > 20 THEN 400 - 9 * i + (i - 20) END AS hi50
FROM range(45) r(i);
CREATE TABLE events AS SELECT * FROM (VALUES (DATE '2026-11-27', 'Black Friday')) t(day, note);
CREATE TABLE promos AS SELECT * FROM (VALUES (DATE '2026-11-24'), (DATE '2026-11-27'), (DATE '2026-12-04')) t(day);
SELECT 12::COL;
SELECT o.day::XAXIS, o.series::CATEGORY, o.units::LINECHART,
o.lo95::BAND_LOWER, o.hi95::BAND_UPPER, o.lo50::BAND_LOWER, o.hi50::BAND_UPPER,
e.day::XBAND_FROM, e.day + INTERVAL 3 DAY::XBAND_TO, e.note::XBAND_LABEL,
CASE WHEN o.units < 50 THEN o.day END::MARKAREA,
DATE '2026-11-21'::XLINE, 'reveal'::ANIMATE,
CASE WHEN o.series = 'Forecast' THEN 'flow' END::LINESTYLE,
CASE o.day WHEN DATE '2026-11-21' THEN 'Today: 220 units left'
WHEN DATE '2026-12-12' THEN 'Below 50 units from here — reorder now' END::STORY,
0::REFLINE, 'Stock runs low by mid-December'::TITLE
FROM outlook o LEFT JOIN events e ON e.day = o.day ORDER BY o.day;
SELECT day::XAXIS, 'Promotions'::TRACK FROM promos;
-- Where did this quarter's profit come from? (as-of chip, switch, KPI with thresholds, bridge, bullet, funnel, drill-down, notes)
CREATE TABLE loads AS SELECT TIMESTAMPTZ '2026-10-17 06:00:00+00' AS loaded_at;
CREATE TABLE bridge AS SELECT * FROM (VALUES
(1, 'Budget', 1200.0), (2, 'Volume', 180.0), (3, 'Price', -60.0), (4, 'Mix', 25.0)) t(i, step, keur);
CREATE TABLE attain AS SELECT * FROM (VALUES (1, 'North', 92.0), (2, 'South', 71.0), (3, 'West', 104.0)) t(i, region, pct);
CREATE TABLE funnel AS SELECT * FROM (VALUES (1, 'Visits', 48000), (2, 'Sign-ups', 6200), (3, 'Trials', 4600), (4, 'Paid', 1150)) t(i, stage, n);
CREATE TABLE sales AS SELECT * FROM (VALUES
('EU', 'DE', 'Berlin', 410.0), ('EU', 'DE', 'Munich', 260.0), ('EU', 'FR', 'Paris', 330.0),
('US', 'US', 'Boston', 520.0), ('US', 'US', 'Austin', 300.0)) t(region, country, city, revenue);
SELECT loaded_at::ASOF, 'stale=24h' FROM loads;
SELECT 'Revenue' AS metric ::BUTTONS UNION ALL SELECT 'Orders';
SELECT false AS eu_only ::TOGGLE, 'EU only'::LABEL;
SELECT 'This quarter'::GROUP;
SELECT 1345.0::METRIC, 1200.0::DELTA, 'vs budget'::DELTA_LABEL, '<1200:bad; <1300:warn; good'::THRESHOLDS,
'Profit (k€)'::LABEL, 'Operating profit before tax, in thousand euros.'::INFO;
SELECT 'Profit beat budget by **{{gap:money}}**; the margin rule is $m = \frac{p}{r}$.'::MARKDOWN,
'success'::CALLOUT, 145.0 AS gap;
SELECT 1::ENDGROUP;
SELECT 6::COL;
SELECT step::XAXIS, keur::WATERFALL, '€'::YFORMAT, 'Volume carried the quarter'::TITLE FROM bridge ORDER BY i;
SELECT 6::COL;
SELECT region::XAXIS, pct::BULLET, 100::GOAL, '60,85,110'::RANGE, 'South is short of target'::TITLE FROM attain ORDER BY i;
SELECT 6::COL;
SELECT stage::XAXIS, n::FUNNEL, 'A quarter of sign-ups never start a trial'::TITLE FROM funnel ORDER BY i;
SELECT 6::COL;
SELECT 'region > country > city'::DRILL;
SELECT CASE getvariable('drill_level') WHEN 'region' THEN region WHEN 'country' THEN country ELSE city END::XAXIS,
CASE getvariable('metric') WHEN 'Orders' THEN count(*)::DOUBLE ELSE sum(revenue) END::BARCHART,
'tween'::TRANSITION,
'US leads; click to drill into countries and cities'::TITLE
FROM sales
WHERE getvariable('region') IN ('', region) AND getvariable('country') IN ('', country)
AND (NOT getvariable('eu_only') OR region = 'EU')
GROUP BY ALL ORDER BY 2 DESC;
In the browser the Markdown placeholders and formula render, the drill chart drills on click and tweens when the buttons change; the static --svg / PNG output draws panels only.
-- Alternative views of one panel: lines, bars or a table over the same weekly revenue
CREATE TABLE weekly AS
SELECT 'W' || lpad((w + 1)::VARCHAR, 2, '0') AS week,
(900 + 40 * w + (hash(w) % 60)::INTEGER) AS revenue
FROM range(10) r(w);
SELECT 'Lines' AS layout ::VIEW; -- opens the group "layout", view 0 (the default)
SELECT 12::COL; SELECT 320::HEIGHT;
SELECT week::XAXIS, revenue::LINECHART, '€'::YFORMAT, 'Revenue by week'::TITLE FROM weekly ORDER BY week;
SELECT 'Bars' AS layout ::VIEW; -- next alternative (repeating the alias is optional)
SELECT 12::COL; SELECT 320::HEIGHT;
SELECT week::XAXIS, revenue::BARCHART, '€'::YFORMAT, 'Revenue by week'::TITLE FROM weekly ORDER BY week;
SELECT 'Table' ::VIEW;
SELECT 'none'::TOTALS;
SELECT week AS "Week" ::TABLE, revenue AS "Revenue" ::MONEY FROM weekly ORDER BY week;
SELECT 1::ENDVIEW; -- optional here (end of script follows)
The three alternatives share one segmented switcher (button labels "Lines" /
"Bars" / "Table") in place of the panel; only the open alternative's query
runs — switching views re-runs just that one, never all three up front. The
group's id for the URL (?view.layout=Bars) comes from the layout alias on
its first marker.
Switcher placement (opt-in, ::VIEW_PLACEMENT): by default the switcher
draws its own row above the card ('row', same as leaving it out). Put
SELECT 'header'::VIEW_PLACEMENT; directly before the group's first ::VIEW
marker (it can stack after ::COL, like any other next-panel modifier) to
move it into the card's own title row instead, right-aligned and compact —
only when every alternative is exactly one panel (the three-alternative
example above would not qualify: each alternative is one panel there too, so
it does). With more than one panel in any alternative, --check warns
(view-placement/not-single-panel) and it falls back to 'row'. The title
wraps before the buttons do; below a minimum card width the buttons fold
into a labelled <select>. Static output (--svg, the CLI, the script-free
served page, ⤓ HTML export) is unchanged either way — it always shows just
the default alternative, with no switcher at all.
::FIT)For a wall display or a one-screen overview, put SELECT 'fit'::FIT; right after the ::TAB (or ::SUBTAB / ::VIEW) that should fill the browser window: its rows of panels share the height under the app and tab bars in their ::HEIGHT ratio, charts are redrawn at that size, tables / ::PAGED scroll inside their panel. A KPI-only row (a ::GROUP of ::METRICs, or a row of bare KPI tiles) is the exception: it keeps its own natural height (~96 px plain, ~36 px 'compact'::KPI_SIZE) instead of sharing — put ::HEIGHT right before the ::GROUP to opt it back in, like a chart row. Only that section fits, only while it is shown; tabs without ::FIT scroll as usual. In a ::SUBTAB / ::VIEW, only that pane's own panels fit (under its bar); the parent tab's panels above keep their height and the page may scroll to reach the fitted pane. With no tabs, a ::FIT anywhere fits the whole dashboard. ?fit=1 fits the shown tab without ::FIT, ?fit=0 never fits; phones (< 600 px) ignore it. The downloaded HTML fits itself too (scaling its drawn SVGs); a page without the app (dashboard file.sql out.html, serve's static page) fits only a dashboard-wide ::FIT (no tabs), in equal rows, with CSS.
-- A one-screen overview tab (no page scroll) beside a detail tab that scrolls
CREATE TABLE sales AS
SELECT DATE '2024-01-01' + INTERVAL (i) DAY AS day, (ARRAY['EU', 'US', 'APAC'])[1 + i % 3] AS region,
100 + (hash(i) % 50)::INTEGER AS amount
FROM range(90) r(i);
SELECT 'Overview'::TAB;
SELECT 'fit'::FIT; -- this tab fills the window; rows keep their ::HEIGHT ratio
SELECT 'Totals'::GROUP;
SELECT sum(amount)::MONEY, 'Revenue'::LABEL FROM sales;
SELECT count(*)::METRIC, 'Orders'::LABEL FROM sales;
SELECT 1::ENDGROUP;
SELECT 6::COL; SELECT 320::HEIGHT;
SELECT region::XAXIS, sum(amount)::BARCHART, 'EU leads on revenue'::TITLE FROM sales GROUP BY 1 ORDER BY 2 DESC;
SELECT 6::COL; SELECT 320::HEIGHT;
SELECT day::XAXIS, sum(amount)::LINECHART, 'Daily revenue holds steady'::TITLE FROM sales GROUP BY 1 ORDER BY 1;
SELECT 'Detail'::TAB; -- no ::FIT: scrolls as usual
SELECT region AS "Region" ::TABLE, sum(amount) AS "Revenue" ::MONEY, 'Revenue by region'::TITLE
FROM sales GROUP BY region ORDER BY "Revenue" DESC;
Keep a fitted tab small: if a panel would get under ~120 px the tab scrolls instead (with a notice). dashboard --check warns ahead of time — layout/fit-too-many (more rows than a 1366×768 screen holds — for a sub-tab / view, only its own panels count; aim for ≤ ~4 rows: a KPI strip and two rows of charts) and layout/fit-ambiguous (a ::FIT before the first ::TAB of a tabbed dashboard, twice for one tab, or cast beside a panel's columns instead of its own statement).
::TOOLTIP, ::TOOLTIP_FORMAT, ::TOOLTIP_HEADER, ::TOOLTIP_MODE)Extra fields and your own wording in a chart's hover tooltip (bar, column, line, area, scatter):
CREATE OR REPLACE TEMP TABLE sales AS
SELECT * FROM (VALUES ('EU', 1200.0, 30), ('US', 1800.0, 41), ('APAC', 900.0, 22)) v(region, revenue, units);
SELECT region ::XAXIS, revenue ::BARCHART, '€'::YFORMAT,
units AS "Units" ::TOOLTIP, -- shown on hover only, never plotted
'{x}: {y} for {Units} units'::TOOLTIP_FORMAT, -- the line per point
'Region {x}'::TOOLTIP_HEADER, -- the header
'US sells the most'::TITLE
FROM sales ORDER BY revenue DESC;
Placeholders: {x}, {y}, {series} and a ::TOOLTIP alias, each with an optional format after : — a ::YFORMAT keyword ({y:€}, {share:percent}), decimals ({y:.1f}) or a strftime pattern for a date ({x:%d %b %Y}). 'single'::TOOLTIP_MODE lists only the hovered mark, 'split' puts a label beside each series' point on a line chart's crosshair, 'none' turns the tooltip off ('shared', the default, lists every series at the x). --check flags an unknown placeholder (tooltip/unknown-placeholder), a bad decimals format and an unknown mode.
::SHOW_IF)SELECT cond::SHOW_IF; is its own preceding statement (like ::COL/::EMPTY): the next panel — or whole ::GROUP box, to its matching ::ENDGROUP — shows only while cond is the BOOLEAN TRUE (FALSE/NULL/no row/a non-boolean/an error all hide it, re-checked on every run). A quiz pattern: give a ::DROPDOWN an empty first option (it defaults to its first option, so check <> '', not IS NOT NULL):
SELECT v AS q1 ::DROPDOWN, l ::OPTION_LABEL, 'Which check sees concept drift?' ::LABEL
FROM (VALUES (1, '', '— choose —'), (2, 'input drift', NULL), (3, 'measured error', NULL)) t(o, v, l) ORDER BY o;
SELECT getvariable('q1') <> '' ::SHOW_IF; -- only after an answer
SELECT CASE getvariable('q1') WHEN 'measured error' THEN '**Right.**'
ELSE 'Not quite — try again.' END ::MARKDOWN;
A hidden panel loses its grid slot (no blank card); a hidden input keeps its variable's value. Stacked ::SHOW_IFs AND together; modifiers (::COL, ::HEIGHT, ::EMPTY, ::ROWSELECT, table options, ::SELECT_AS, ::DRILL) right before the condition travel with its target, so they never leak onto the next panel. ::TAB/::SUBTAB/::VIEW/::ENDGROUP/::FIT/::COLUMNS/chrome can't be a target (show_if/bad-target) — use -- @requires for those. Not access control: on a locked server the hidden statement still answers /api/panel. --check also flags a condition beside other roles (show_if/not-alone), one that reads no variable (show_if/constant), a getvariable() this dashboard never sets (show_if/unknown-variable), and — under the defaults used while checking — a non-boolean cell or no row at all (show_if/not-boolean / show_if/no-row).
::GUIDE_STEP)SELECT 'Name' AS id ::GUIDE_STEP; opens the next step of a guided sequence (onboarding, a tutorial): Back/Next, a progress strip ("Step n of N"), and — unlike ::VIEW — its markers are not consecutive: everything after one belongs to that step, up to the next marker or the group's close (the next ::TAB, a ::SUBTAB, or end of script). Add ::GATE/::GATE_MESSAGE columns on the marker to hold Next until a condition is met:
SELECT 'The three doors' AS lesson ::GUIDE_STEP;
SELECT '**Scenario**: a model''s accuracy drops. Is the *input* drifting, or the *relationship* itself?' ::MARKDOWN;
SELECT 'Check your understanding' ::GUIDE_STEP, -- the gate lives on the SAME step as its own quiz
getvariable('q2') = 'measured error' ::GATE,
'Answer correctly above to continue' ::GATE_MESSAGE;
SELECT v AS q2 ::DROPDOWN, l ::OPTION_LABEL, 'Which check sees concept drift?' ::LABEL
FROM (VALUES (1, '', '— choose —'), (2, 'input drift', NULL), (3, 'measured error', NULL)) t(o, v, l) ORDER BY o;
SELECT getvariable('q2') <> '' ::SHOW_IF;
SELECT CASE getvariable('q2') WHEN 'measured error' THEN '**Right.**' ELSE 'Not quite — try again.' END ::MARKDOWN;
SELECT 'Drift sandbox' ::GUIDE_STEP;
SELECT 'A sandbox you only reach once the quiz is right.'::MARKDOWN;
SELECT 'Wrap-up' ::GUIDE_STEP;
SELECT 'Nice work — you can revisit any step from the list above.' ::MARKDOWN;
The step variable (lesson above; step/step_2/… for unnamed groups) is an ordinary getvariable() name, readable from any panel and carried in the URL as ?v.lesson=n; list it in -- @vars if the dashboard declares one. The gate uses the same fail-closed rule as ::SHOW_IF (FALSE/NULL/no row/non-boolean/an error all hold Next closed). It's common for a gate to read its own step's quiz (the shape above) — both the interactive browser and dashboard --check check that reading with the quiz's own input default already bound, so the canonical pattern lints clean. The step list lets a viewer jump to any step up to the furthest one whose gate holds, and clamps a URL/seed asking for one beyond that. Not access control: /api/panel answers every step's statement whether its gate holds or not. A ::GUIDE_STEP marker closes an open ::VIEW group / ::GROUP box, like a ::TAB does; it can't open inside a ::SUBTAB (step/inside-subtab) — a sequence is a sibling of ::SUBTAB under a ::TAB, never nested in one. Static output (--svg, the CLI HTML, the script-free served page, ⤓ HTML export) flattens the sequence: every step draws in order under a "Step n of N · Label" heading, gates ignored.
-- @tour)A client-side walkthrough over a dashboard's existing panels — a spotlight + callout per step, Back/Next/Done — for onboarding and product tours. Unlike ::GUIDE_STEP it adds no panels; it lives entirely in header comments, next to -- @title, and targets statements by their -- @name:
-- @tour cockpit_intro Cockpit in three steps
-- page: This page lists every monitored model and what to do next.
-- severity_kpi: This is a model's severity.
-- status_table: Click a model to open its Model Monitoring page.
-- @tour_autostart cockpit_intro
id matches ^[A-Za-z_][A-Za-z0-9_-]{0,63}$; its steps are the comment lines directly following it (-- + two spaces or a tab + target: text) — a blank line, or any other header line, ends the block. target is page (a centred callout, no spotlight — for an intro/outro) or a -- @name on this dashboard; text is up to 400 characters, shown as plain text only (never Markdown/HTML). Up to 20 steps per tour, 10 tours per dashboard. Start it with ?tour=<id>, the toolbar's 🧭 Tour button, or once per browser with -- @tour_autostart <id> (never during a preview or in the ⤓ HTML export). The tour opens whichever tab/sub-tab/::VIEW pane a target sits in, like a click would; a target inside a ::GUIDE_STEP pane is only opened when that step is reachable (a tour never bypasses a ::GATE); an unknown or hidden (::SHOW_IF/-- @requires) target is skipped. Not access control: like ::SHOW_IF, it only changes what the page shows for a moment. --check reports tour/bad-id, tour/duplicate-id, tour/unknown-panel, tour/autostart-unknown (errors) and tour/empty, tour/long-text, tour/too-many-steps, tour/too-many, tour/stray-step (warnings).
Both patterns above default to localStorage (per browser). On a server with options.state (::SUBMIT), a signed-in viewer's progress can be remembered across devices instead — no new endpoint, Next still pure navigation. Tour already seen: give the done-marking ::SUBMIT the same id as the tour and gate it "record once" (WHERE NOT EXISTS (SELECT 1 FROM viewer_state WHERE submit = '<tour id>')); once clicked, that panel's absence (zero rows) tells the browser to skip -- @tour_autostart next time — keep that panel out of a hidden tab/step, or "not lazily rendered yet" looks the same as "already done". Resume a guide step: record each gated step with its own ::SUBMIT (WHERE <the step's own gate> AND NOT EXISTS (SELECT 1 FROM viewer_state WHERE submit = 'step2_done')), then on the intro show a ::SHOW_IF-gated ::MARKDOWN link back to it ([Resume →](?v.lesson=2)) — the same ?v.<name>=n the step strip already writes. See docs/DOCS.md's "Remembering progress" section for the full worked example.
Full rationale: docs/dashboard-design.md. [lint] = checked by --check (design/*).
| You have | Use |
|---|---|
| one headline number | ::METRIC / ::MONEY / ::PERCENT + a ::LABEL caption |
| a number over time | ::LINECHART (+ ::SMOOTH for a trend); ≤ ~6 series |
| a number by a discrete category | ::BARCHART sorted by value; part of whole → ::BARCHART_STACKED or ::DONUTCHART (≤ 6 slices) |
| how concentrated: the top N of many items (products, customers) | ::PARETO over every item only (its line is the share of the rows it gets, so after a LIMIT it ends at 100 %); for a top N: ::BARCHART + the share of the total from SQL, 100 * sum(v) OVER (ORDER BY v DESC) / sum(v) OVER (), as a ::LINECHART on ::Y2 with 'percent'::Y2FORMAT, then LIMIT |
| several measures per item (on-time %, lead days, order count per supplier) | a ::TABLE: one row per item, a format per column (::PERCENT, ::METRIC, ::MONEY), ::COLORSCALE on the one to compare — a chart shows one measure (two on ::Y2), so it would drop the others |
| a distribution | ::HISTOGRAM, or ::BOXPLOT / ::VIOLIN by a category; too many rows to send → a box from statistics (::Q1 ::MEDIAN ::Q3, computed in SQL) |
| some bars must stand out (below a target, the top 3) | a status column from SQL as ::CATEGORY with a ::COLORS level map: CASE WHEN rate < 50 THEN 'below 50 %' ELSE '50 % or more' END::CATEGORY, 'below 50 %:bad; 50 % or more:#9aa3af'::COLORS (::THRESHOLDS on a chart only draws lines) |
| two numbers | ::SCATTER (third as ::BUBBLE / ::SIZE) |
| two categories + a measure | ::HEATMAP |
| a forecast with its uncertainty | ::LINECHART + one ::BAND_LOWER / ::BAND_UPPER pair per level (pivot long quantiles with max(lower) FILTER (WHERE level = 0.95)) |
| events / features to read against a time chart (promotions, alarms, price) | ::TRACK strips right after the chart, not a separate panel |
| progress toward a goal | ::GAUGE + ::RANGE; several rows vs their targets → ::BULLET + ::GOAL + ::RANGE 'poor,ok,good edges' |
| how a total moved (budget → actual, last year → this year) | ::WATERFALL: first row = start, then signed steps (NULL row = subtotal) |
| conversion through ordered stages | ::FUNNEL (stages in SQL order, first on top) |
| where it happens: by country / state / district code | code::REGION + the measure ('quantile 5'::CLASSES, 8::LABEL_TOP); built-in countries, German states and districts — no geodata needed |
| where it happens: by location | lat::LAT, lon::LON points over 'world'::BASEMAP (or 'de-states') |
| any other geography (WKT) | ::MAP |
| how much, where (counts at places) | lat::LAT, lon::LON (or code::REGION) + n::SIZE: graduated symbols, area ∝ n; colour by a measure or ::CATEGORY |
| many points (thousands of customers, events) | lat::LAT, lon::LON, 'auto'::HEXBIN (+ a measure to sum) — density in equal-area hexagons |
| two measures by region (sales vs margin, distance vs coverage) | code::REGION, a::BARCHART, b::BIVARIATE — a 3×3 palette |
| how a map changes over time (on-time share per state by week) | week::FRAME next to any map: one result, shared classes; Play steps through it |
| each region's trend, on hover | list(v ORDER BY week)::SPARKLINE next to the map's measure: a mini chart in each feature's tooltip |
| a map that will be printed or exported | 'print'::NORTH_ARROW ('always' to show it on screen too): a north arrow turned to true north |
| a few periods or groups side by side (four weeks, two channels) | week::FACET next to the map's input: one map per value, shared classes and legend (at most 12; not with ::FRAME) |
| what moves between places (shipments, migration) | src::ORIGIN, dst::DEST, volume::SIZE (codes, WKT POINTs or {'lon','lat','name'} structs); 'flow'::LINESTYLE animates |
| a process, pipeline or lineage: steps and what flows between them | ::DIAGRAM (one row per step; edges from ::UPSTREAM or ::EDGES) |
| row-level detail | ::TABLE (::PAGED if large / remote); flag / rank with ::FLAG / ::HIGHLIGHT, not colour alone |
::GROUP … ::ENDGROUP [lint: ungrouped-kpis] → the primary full-width chart → 2-up breakdowns → a detail table.'Revenue up 12% YoY', not 'Revenue') [lint: untitled-chart]; format money / percent axes ('€'::YFORMAT).''::DATALABELS, formatted by ::YFORMAT) and put the key figure or gap in a ::SUBTITLE ('US leads APAC by $14.8k (0.5 %)'). Shares get 'percent'::YFORMAT (values 0–100).1::FLIP.::TAB [lint: too-many-panels].docs/dashboard-design.md §7): default to 2-up (6::COL), full width for time series and tables; equalise a 2-up row with ::HEIGHT; title 2-up panels with a ::TITLE column (a lone ::LABEL heading forces a new row); a ::GROUP is always full width (use it for KPI strips and filter boxes, not for side by side); keep the top to one slim row (a bare ::DROPDOWN filter, no banner repeating the KPIs).CASE before ::COLOR.::INFO — "Stock here is on hand plus on order: 1,240 units." Ask first only when the choices give very different answers and nothing in the data or the request decides it.'Which regions are behind plan?'::DASHBOARD_TITLE, -- @title), never by method or technology. When that question is too long for a nav bar / start-page card, give it a short -- @nav <label> too (@title stays the page's own heading). Place it with -- @group <area> (/ for one sub-level), find it with -- @tags a, b (≤10), describe it in one line with -- @description, and say who looks after it with -- @owner <team> and, once checked, -- @certified YYYY-MM-DD (a ✓ badge) header lines. Where the numbers come from (stored model runs, the ETL job) goes in -- header comments and the README, not as a note or banner on the page; freshness goes in an ::ASOF chip. For a dashboard a screen-reader or keyboard-only audience will rely on, add -- @astables on so the "▦ Charts as tables" bar is there without the viewer having to find it in the menu first — leave it off (the default) otherwise, since every viewer can still switch to tables from the toolbar's ⋯ → Charts as tables menu item.light); add a ::THEME only for a real brand.Complete references: examples/dashboards/sales-overview.sql (self-contained, lints clean), examples/sp500-dashboard/sp500.sql (cross-filtered), web/examples/statistics-showcase.sql (contract plots in ten tabs).
Fill the <placeholders> from --describe, then --check.
-- Overview: filter → KPIs → trend → breakdown → table
SELECT <cat> AS <cat> ::DROPDOWN FROM <t> GROUP BY <cat> ORDER BY 1;
SELECT 'Totals'::GROUP;
SELECT sum(<measure>)::MONEY, 'Total'::LABEL FROM <t> WHERE <cat> = getvariable('<cat>');
SELECT count(*)::COMPACT, 'Rows'::LABEL FROM <t> WHERE <cat> = getvariable('<cat>');
SELECT 1::ENDGROUP;
SELECT 12::COL;
SELECT <date>::XAXIS, sum(<measure>)::LINECHART, '€'::YFORMAT, '<takeaway>'::TITLE
FROM <t> WHERE <cat> = getvariable('<cat>') GROUP BY <date> ORDER BY <date>;
SELECT <cat2>::XAXIS, sum(<measure>)::BARCHART, '<takeaway>'::TITLE
FROM <t> WHERE <cat> = getvariable('<cat>') GROUP BY <cat2> ORDER BY 2 DESC;
SELECT 12::COL;
SELECT <cat2> AS "<Cat2>" ::TABLE, sum(<measure>) AS "Total"
FROM <t> WHERE <cat> = getvariable('<cat>') GROUP BY <cat2> ORDER BY "Total" DESC;
-- Distribution: multiselect → histogram + boxplot
SELECT DISTINCT <cat>::MULTISELECT FROM <t> ORDER BY 1;
SELECT <measure>::HISTOGRAM, '<takeaway>'::TITLE FROM <t>
WHERE (len(getvariable('<cat>')) = 0 OR list_contains(getvariable('<cat>'), <cat>));
SELECT <cat>::XAXIS, <measure>::BOXPLOT, '<takeaway>'::TITLE FROM <t>
WHERE (len(getvariable('<cat>')) = 0 OR list_contains(getvariable('<cat>'), <cat>));
A producer (pgmpy, bnlearn, a DuckDB extension) writes plain tables; web/examples/bayes-auto-eda.sql is the template (DOCS → Automatic analysis of a Bayesian network lists the columns). The recipes:
node || ' = ' || state ::DUMBBELL, 100 * p_given_not_target AS "not in the target" ::XMIN, 100 * p_given_target AS "in the target" ::XMAX, '×' || printf('%.1f', lift) ::LABEL, 'percent'::YFORMAT … ORDER BY lift DESC.anofox_plot_matrix(t, row := 'a', col := 'b', value := 'normalized', cluster := true, domain := [0, 1]) — clustering order, related variables side by side.::BARCHART + 1::FLIP, or cost ::XAXIS, mutual_information ::SCATTER, CASE WHEN efficient THEN mutual_information END ::LINECHART — a line over a scatter joins its non-NULL rows (the efficient frontier); efficient = more information than every cheaper question (a window max(...) OVER (ORDER BY cost …)).::TABLE (probability in-cell bar), surprise as stacked bars by status (::COLORS level map), conflict as a ::GAUGE with '-3,3'::RANGE, the hypothesis as evidence comes in as a ::WATERFALL.One row per node; the ::DIAGRAM (::NODE) column is the id. In the box: ::LABEL, a KPI format (::COMPACT, ::MONEY, …) and ::BADGE (status word → pill colour; ::THRESHOLDS on the value wins). Edges: inputs::UPSTREAM (an id or a list of ids feeding this row), or for edges with a count, label or style one scalar subquery:
CREATE OR REPLACE TABLE run_manifest AS SELECT * FROM (VALUES
(1, 'ingest', 'Ingest', 10000, 'ok'), (2, 'build', 'Build twin', 9800, 'ok'),
(3, 'monitor', 'Monitor drift', 412, 'alarm'), (4, 'calibrate', 'Calibrate', 37, 'warn')
) t(seq, stage, title, records, status);
CREATE OR REPLACE TABLE run_edges AS SELECT * FROM (VALUES
('ingest', 'build', 9800, false), ('build', 'monitor', 9800, false),
('monitor', 'calibrate', 412, false), ('calibrate', 'build', 29, true)
) t(from_stage, to_stage, n, loop);
SELECT 12::COL; SELECT 320::HEIGHT;
SELECT stage::DIAGRAM, title::LABEL, records::COMPACT, status::BADGE,
(SELECT list({'from': from_stage, 'to': to_stage, 'value': n, 'style': CASE WHEN loop THEN 'flow' END}) FROM run_edges)::EDGES,
'Drift sends 29 calibrations back to the twin'::TITLE
FROM run_manifest ORDER BY seq;
Layers run left to right ('TB'::DIRECTION for top to bottom); loops are drawn as edges running back. Row order breaks ties, so order the rows by the process. Give it 12::COL and a ::HEIGHT; a click on a node cross-filters ('stage'::SELECT_AS → getvariable('stage')), edges are hover-only. Not for free drawings: no positions or shapes yet.
Motion: stages appear one after another by default ('none'::ANIMATE = off). style in ::EDGES or ::LINESTYLE on a row (styles the edges into that node; a constant = every edge): 'flow' moving dashes, 'flow-dots' travelling dots, 'dashed'. CASE stage WHEN 'monitor' THEN '412 twins drift' END::STORY makes Step / Play steps that light the node and every edge touching it. Keyboard: the arrow keys follow the connections. Edges with a value are as wide as what they carry; a status word (ok / delayed / failed / late) colours them. A run picker plus 'tween'::TRANSITION changes widths, colours and values in place. See the example "How does data move through our pipeline?". team::LANE groups nodes into labelled swimlanes; stage_no::XAXIS pins a node's stage (::XAXIS + ::YAXIS on every node: placed by hand); list(v ORDER BY t)::SPARKLINE draws a trend in the box; 'flow-volume' edges move faster the more they carry. From two tables without dashboard SQL: SELECT anofox_plot_diagram(n, edges := (SELECT list(e) FROM run_edges e)) FROM run_manifest n (Grafana names id/title/mainstat, source/target/value; stage, from_stage, to_stage, count read too). Factor graphs (Forney style): kind::SHAPE per node (factor box, variable circle, data filled circle, equality small square, delta black square, constant text) makes the diagram a factor graph — layer::LANE bands (param / state / obs) stay straight rows, edges are undirected with their label at the factor; from an inference library's tables (the factor-graph plugin, so start with SELECT 'factor-graph'::REQUIRES;): SELECT anofox_plot_factor_graph(n, edges := (SELECT list(e) FROM fg_edges e), marginals := (SELECT list(m) FROM fg_marginals m), schedule := (SELECT list(s) FROM fg_schedule s)) FROM fg_nodes n — schedule := adds Step / Play through the messages, and with marginals := each variable shows its belief curve (::BELIEF), sharpening step by step. Any ::DIAGRAM can step along edges: give an ::EDGES item 'steps': [{'n': 1, 't': 'caption', 'dir': 'back'}]. Bayesian networks (the bayes-net plugin: SELECT 'bayes-net'::REQUIRES;): SELECT anofox_plot_bayes_net(n, arcs := (SELECT list(a) FROM bn_arcs a), beliefs := (SELECT list(b) FROM bn_beliefs b), evidence := (SELECT list(e) FROM bn_evidence e), tables := (SELECT list(t) FROM bn_tables t)) FROM bn_nodes n — nodes id, label, kind (chance / observed / decision / utility / deterministic), states a LIST; arcs from, to, strength; beliefs node, state, probability, prior; evidence node, state; tables node, parent_states, state, probability (parent states in arc order). Draws a top-down DAG with a bar per state, the prior faint behind it, observed nodes shaded, arcs dashed below threshold := 0.5; hover shows the CPT. See the example "What does the evidence say about the cause?".
Editable (#682): 'edit' AS graph ::DIAGRAM_MODE on the diagram adds a toolbar (Add a node of a type, Connect — or drag a node onto another (onto empty space: move it to that stage), Rename, Remove, Reset); the edited graph is ONE JSON variable {"nodes":[{id,type,label}],"edges":[{from,to}]} read in SQL with unnest((getvariable('graph')->'nodes')::JSON[]) + n->>'id'. Optional before it: SELECT type ::DIAGRAM_PALETTE, label, connects_to FROM node_types (which types may feed which), and SELECT id ::DIAGRAM_CHECK, status, message FROM (…getvariable('graph')…) (#699: the edited graph's problems — a node id, 'from -> to' or NULL for the whole graph; 'bad'/'warn'; coloured on the diagram, listed under the toolbar, re-run after every edit). Pair it with a ::FORM filtered by the selected node for per-node parameters. Save the edits with SELECT 'Save plan' ::SAVE, 'graph' ::SAVE_GRAPH, 'plan_nodes, plan_edges' ::SAVE_TABLES (a form: 'lt' ::SAVE_FORM, 'plan_params' ::SAVE_TABLES, one row per clicked node, column id; 'node' ::SAVE_KEY names another variable as the row's key) — in the builder the saved rows shadow the base tables in this tab (#684).
Scenarios (anofox-scenario, locked server with options.scenarios, #1243): SELECT name AS scenario ::SCENARIO FROM anofox_scenarios() picks the branch every unqualified table reads. A writer adds one with SELECT 'Add scenario' ::SAVE, 'create' ::SAVE_ACTION, 'new_name' ::SAVE_KEY, 'scenario' ::SAVE_SCENARIO (the new_name input holds the name: letters, digits, _) and saves a form's row into the picked one with SELECT 'Save' ::SAVE, 'cap' ::SAVE_FORM, 'capacity' ::SAVE_TABLES, 'scenario' ::SAVE_SCENARIO (never into main). Approvers (options.scenarios.approvers) get 'freeze', 'unfreeze', 'merge' (make it official: previewed first, refused on conflicts) and 'drop' as ::SAVE_ACTION on the picked scenario. Compare with anofox_scenario_rows('plan') (a scenario column) and anofox_scenario_diff('name', 'plan').
Use motion where it tells the story, not as decoration; --svg/PNG/PDF stay static and reduce motion shows the final state.
'auto'): lines draw, bars grow by x, points pop in. Opt out per chart with 'none'::ANIMATE.DATE '…'::XLINE (Today) + 'reveal'::ANIMATE — history wipes in, then the fan grows forward from Today.CASE WHEN series = 'Forecast' THEN 'flow' END ::LINESTYLE — moving dashes for the predicted series ('dashed' = still); static output shows dashes.CASE x WHEN 'W48' THEN 'caption' END ::STORY (on a ::DIAGRAM: per node) — Step / Play controls that light up one x (or series: 'series'::STORY_BY) and dim the rest, with the caption. 2–5 steps that each say what to look at and why. Never name it ::STEP (that is the step-line chart).'tween'::TRANSITION on a chart an input or cross-filter changes: its marks move to the new values (≤ 300 ms) instead of a swap — the eye follows what changed.Charts are keyboard-navigable (Tab into a chart, arrows across marks, Enter = click, Esc leaves), each gets a generated screen-reader summary, a Charts as tables switch swaps every chart for its data, and reduced motion is honoured. The summary uses the panel's ::TITLE — give every chart one (also design/untitled-chart).
In the builder (web/, serve <db>, anofox_serve) the sidebar's Explore data page lists every table / view / added file (CSV, Parquet, JSON, https:// URL); a table opens as column cards (type, empty %, distinct, histogram / top values / date range, quality hints, likely joins) over its ::PAGED rows. Chart this previews a chart and Add to dashboard appends its annotated SQL; New dashboard from this table writes a starter (KPIs, ::ASOF, ::PERIOD, a filter, trend, top-N, distribution, rows); Compare… diffs two tables or two time ranges and writes a starter with ::DELTAs; with anofox_tabular loaded each hint can Run the check. Locked servers have no Explore page. From a terminal, dashboard --describe gives the same grounding.
These silently break a panel (it renders wrong or vanishes):
WITH is fine (WITH s AS (…) SELECT x::XAXIS, n::BARCHART FROM s); casts inside a CTE body or subquery are plain SQL, and DDL / DML (CREATE … AS SELECT, INSERT … SELECT) is always setup.::DATE, ::TEXT, ::STRING, ::NUMERIC are also SQL types. They make an input only in an input statement; in a chart they stay casts. Cast and tag by chaining: ts::DATE::XAXIS.::TABLE marker per table, not one per column; the other columns keep their AS "Header" aliases.::CATEGORY / ::COLOR is discrete: a raw continuous column gives one legend entry per value.::LABEL, not ::TITLE (::TITLE is a title bar).x AS a ::BARCHART names the legend entry) unless you mean it; for inputs the alias is the variable name.GROUP BY ALL; a ::ROLE must be in the SELECT list, not after FROM.::PAGED instead of ::TABLE.'single'::ROWSELECT / 'multi'::ROWSELECT before the table; without it a click does nothing and getvariable('<first column>') stays unset. The first column is the key and must be non-numeric (a text id / name). Table directives (::ROWSELECT, ::TOTALS, ::COLGROUP, ::FLAG, ::HIGHLIGHT, ::SUBTOTAL) — like ::SELECT_AS, ::DRILL and ::EMPTY on a chart — are each their own preceding statement (the same shape as ::COL/::HEIGHT), never an extra column on the panel's own SELECT: SELECT 'single'::ROWSELECT; SELECT id ::TABLE, name FROM t;, not SELECT id ::TABLE, name, 'single'::ROWSELECT FROM t; (that embeds 'single' as a literal extra column and the row click still does nothing). dashboard --check --strict flags the embedded form (layout/next-panel).range(n) / VALUES in setup statements, as above.SELECT 'No orders in range — widen the dates'::EMPTY; before a filtered panel replaces the generic "No data for this selection". Optional outputs (a file only some runs write): put -- @requires data/run/x.parquet on its own line directly above the statement — a missing file then shows "Not available" instead of an error card. Commas = all needed; a.parquet | b.parquet = either name will do; ${name} = getvariable('name') (e.g. -- @requires ${rd}/forecasts.parquet after SET VARIABLE rd = getvariable('anofox_data') || '/' || getvariable('run')); a relative path resolves against anofox_data when set. On a locked server ${name} must be server-side (anofox_data, a path_vars variable, or set by the dashboard) and the path must stay inside the data folder. Above a ::TRACK a missing input leaves the strip out. Optional tabs: -- @requires directly above SELECT 'Forecastability'::TAB; (or a ::SUBTAB) hides the whole tab — button, pane, panels (never run, also on a locked server) — when the input is missing, instead of a tab of "Not available" cards; ?tab= to it opens the first shown tab. Set the tab's ${name} above the tab statement.::XLINE_LABEL, ::XBAND_FROM/_TO/_LABEL and ::ANNOTATE read the row they are on: LEFT JOIN events e ON e.day = s.day and select e.day::XLINE, e.note::XLINE_LABEL — only the rows that carry an event draw it.::THRESHOLDS inside a ::TABLE statement is just a column. Put the table's rules in their own statement before it, naming the columns.::VIEW switchers: shared controls (inputs, KPIs, filters) go above the first ::VIEW marker, not inside one of the alternatives — a view's own panels only show while that view is open. Close the group with ::ENDVIEW if panels that are not part of it follow (another ::GROUP, another ::VIEW group, or plain panels); it's optional when a ::TAB / ::SUBTAB / ::SECTION or the end of the script follows instead.| Where | How |
|---|---|
| Static HTML | dashboard file.sql [out.html] (inputs, tabs and directives are skipped) |
| Browser builder | the live demo or web/ (DuckDB-Wasm, no server): paste the script, Run; Explore data profiles tables; Share puts the SQL and the view in the URL, ⤓ HTML saves a standalone file |
| Live DuckDB, authoring | SELECT anofox_serve(8080); (from-source build) or the serve <db> binary |
| To consumers, locked | SELECT anofox_serve_dashboards('<dir>', 8095); — each .sql file of the folder is a page /d/<name> with a shared nav bar; ::TAB pages deep-link via ?tab=<name>; ?v.<variable>=<value> pre-sets an input or a selection (validated against the input's options) |
Modes, options, limits and deployment: the serving skill; login, row / column policies and embedding: the access-control skill.
Telemetry: any -- @load of an anofox extension (anofox_statistics, anofox_forecast, anofox_tabular, anofox_optimize, anofox_decide) stays silent — dashboard/serve and the anofox_visualization extension itself default DATAZOO_DISABLE_TELEMETRY to 1 before anything else can load. To opt in, set DATAZOO_DISABLE_TELEMETRY=0 yourself before anofox_visualization loads.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub datazoode/anofox-visualization --plugin anofox-visualization5 skills in this plugin
/anofox-visualization-access-controlWho may see which dashboard rows and columns on an anofox-visualization locked server: login (options.auth / serve --auth) through an auth proxy (oauth2-proxy, Caddy forward_auth, nginx auth_request, Cloudflare Access, shared secret, trusted_proxies), built-in JWT bearer tokens, OIDC login (PKCE, sessions, logout, revocation_file), signed embed links for iframes (Metabase / Superset-style guest embedding), hashed API keys (serve api-key new / revoke / list), the reserved claim variables (__claim_user, __claim_groups, __claim_<name>), -- @vars, row and column access policies (policy.json: row filters, deny / null / mask / hash columns, table_functions, functions, policy_key_env), what a policy refuses, `dashboard --check --policy` (policy/* lints), the request log and the audit log, and which identities may submit through options.state's ::SUBMIT (a personal sign-in only — no API key, no embed link without its own user, #517). Use when the user asks for "login / SSO / OIDC / Keycloak / Entra / Auth0", "row-level security", "each customer / tenant / region sees only its rows", "hide or mask a column", "embed a dashboard in our app", "API key for a script", "audit who looked at what", or gets a 401 / a refused start from auth or policy. Serving modes, options and deployment are in the serving skill.
/anofox-visualization-chartsSQL to SVG with the anofox_visualization DuckDB extension: the anofox_render(spec) scalar (rows + ::ROLE annotations as JSON, width / height, brand colour, category cap, line downsampling), the column macros anofox_bar, anofox_line, anofox_scatter, anofox_area, anofox_xy(x, y, kind :=) and anofox_xyc(x, y, series, kind :=), which chart kinds `kind :=` accepts (bar, stacked / percent bars, line, area, step, scatter, bubble, jitter, histogram, density, boxplot, violin, QQ, pie, donut, radar, sparkline, heatmap, calendar), one SVG per GROUP BY group, saving the SVG to a file, the error messages, and the community (render-only) build versus the full-toolkit C-API build (a GitHub release or from source: render + serving). Use when the user wants "a chart from this query", "render an SVG in DuckDB", "plot these columns", "a bar / line / scatter chart in SQL", asks what anofox_render expects, how to install or load anofox_visualization, or why a chart call fails. For model output tables (coefficients, residuals, ROC, forecasts) see the statistics-plots skill; for ::ROLE dashboards the dashboards skill.
/anofox-visualization-servingServe and deploy anofox-visualization dashboards from DuckDB: anofox_serve(port) (the authoring builder with Explore on the live session), anofox_serve_dashboards(dir, port[, options]) (locked, read-only serving of a folder of ::ROLE .sql dashboards to consumers), anofox_serve_refresh(port), anofox_serve_stop(port), and the standalone `serve` binary (authoring on a database file, or `serve --dashboards` static server-side rendering with whitelisted -- @param values). Covers which mode to pick, the trust model (server-owned SQL, typed variables, read-only snapshot, Host allowlist), every option (max_rows, timeout_ms, threads, warm, max_queries, max_inflight_mb, max_response_mb, cache_mb, memory_limit, duckdb_threads, bind, hosts, search_path, app, home, attach, load, refresh_s, data, path_vars, theme), the result cache, single-flight and cancelled requests, snapshot refresh, a live data folder, /healthz, header comments (-- @title, -- @nav, -- @group, -- @tags, -- @description, -- @owner, -- @certified, -- @load, -- @param, -- @vars, -- @requires) and deployment (deploy/run-locked.sh, systemd, Docker, reverse proxy with TLS, replicas behind a load balancer, sizing). Also covers options.state (per-viewer, append-only answers from a ::SUBMIT button, #517), viewer_state/viewer_state_latest read-back, and the dashboard state export|erase CLI for retention/erasure. Use when the user wants to "share / publish / host / deploy a dashboard", "serve it to my team", "put it behind nginx / Caddy", "run it in Docker / Kubernetes", "open the builder on my data", asks whether serving is safe, how to refresh served data, or gets "nothing is serving on port", "already serving", 421 / 503 / 413 errors. Login, SSO, row-level security and embedding are in the access-control skill. Serving needs the C-API build (release or from source; the community build is render-only).
/anofox-visualization-statistics-plotsPlot model and test output of anofox-statistics (v0.11) and anofox-forecast with the anofox_visualization contract macros: anofox_plot_terms (coefficient forest, lambda / LARS paths, quantile process, rolling coefficients), anofox_plot_summary (model comparison of glance metrics), anofox_plot_obs and anofox_plot_diagnostics (residuals vs fitted, QQ, scale-location, leverage, Cook's distance, the plot.lm 2x2), anofox_plot_prediction (fit + band, train / test / future split, forecasts, effect plots, model differences), anofox_plot_curve (ROC, PR, calibration, Kaplan-Meier, ACF / PACF, CV error with lambda.min / lambda.1se), anofox_plot_tests (post-hoc comparison forest), anofox_plot_compare (box / violin / points with significance brackets), anofox_plot_partial (component + residual, added-variable), anofox_plot_cv (cross-validation fold timeline, provisional), anofox_plot_schedule (Gantt chart: one lane per resource, bars coloured by status, a due-date mark, faceted by model_id to compare algorithms), forecast), anofox_plot_checks (anofox-tabular data-quality checks: a band of pass/warn/fail dots against their acceptance range, or a status strip over time), anofox_plot_decomposition (time-series decomposition panels: observed, level, trend, seasonal, remainder; provisional), anofox_plot_matrix (correlation-style heatmap: row/col/value, a diverging scale around 0, anofox-tabular profile_correlations as it comes, mirrored to the full matrix), anofox_plot_diagram (a process / pipeline graph from node and edge tables), anofox_plot_assignment (anofox-optimize bin packing / wave batching: items stacked per bin or wave, capacity as a reference line), anofox_plot_distribution (anofox-decide categorical distributions: bars per id, a 100% stacked bar over several ids) and anofox_plot (auto), with every option (title, x_label, y_label, highlight, lambda_min, lambda_1se, facet, reference, band, kind, events, base_rate, metrics, baseline, label_top, alpha, value, label, factor, tests, hide_ns, components, domain, mirror, labels, width, height), anofox_contract_version(), the alias-the-row calling convention, GROUP BY for one plot per group, the producer to macro table, and using them in ::ROLE dashboards and the browser builder. Use when the user wants to plot a regression, coefficients, residual diagnostics, a forecast, a ROC curve, survival curves, test results, a correlation / confusion matrix or a data-quality check result (anofox-tabular run_checks / agg_check / null_rate / profile_correlations / …), asks "how do I plot ols_tidy_by / ts_forecast_by / statsforecast / run_checks / profile_correlations output", or a contract plot call errors. Also for results computed in Python or R: the anofox_viz Python package (from_statsmodels, from_sklearn, from_estimator, from_scipy, from_pingouin, from_lifelines, from_statsforecast, from_prophet, plot), pandas / polars DataFrames in-process through the duckdb package, Jupyter, R broom tables, and Parquet files into a dashboard.
Other plugins' skills for the same job