Charts, tables, pivots and KPIs

funcional

Seventeen chart kinds with suggestions, formatted tables, pivots and KPI scorecards, click-to-filter, and where every chart's data came from.

A chart cell under a query offers the charts that fit its columns, KPI tiles compare against the previous period and a target, and clicking a bar filters the cells that read the chart.

Real recording · typing sped up · Northwind demo data

Open the walkthrough on its own page

Chart, Table, Pivot and KPI cells turn another cell's result into something easier to read. They don't query the database: each reads its Input cell's result, updates as soon as that result changes, and says plainly when it is looking at only part of the data. Any of them can also be shown as its output alone, for a notebook that reads like a report; see Embedded outputs.

Chart cells

  1. Adicione uma Chart cell under the query you want to draw and pick that query with Choose input.
  2. Pick one of the three suggestions ("Suggested: Bar of Revenue by ShipCountry"), worked out from the result's columns, or press Editar to build it yourself.
  3. Pressione Concluído to close the editor. The chart redraws whenever its input runs.
SQLly
Chart cell with three suggested chart buttonsChart cell with three suggested chart buttons
A new chart cell under a revenue-by-country query, offering three suggested charts for its columns.

The editor has:

Chart type
Any of the 17 kinds below.
Colunas
X axis / category, Valor, Second value, Split by (one series per value), Bubble size e Cor por.
Agregado
As is, Sum, Average, Count, Distinct count, Minimum, Maximum or Median, for rows that share a category.
Sort and Top N
Natural order, Category A–Z or Z–A, Largest or Smallest first; Top N keeps the biggest categories, with Group the rest as Other.
Date grouping
None, Hour, Day, Week, Month, Quarter or Year, for a date or time X axis.
Missing values
Leave a gap, Treat as zero, or Skip rows.
Bars
Side by side, Stacked or Stacked to 100%, and Horizontal.
Valores
Show values on the marks; Value format Plain, Percent, Currency or Compact (1.2K), with a Unit e um Currency code.
Reference lines
Lines at fixed values, separated by semicolons: 100 Target; 80 Warning?; 50 Critical!. A trailing ? draws a warning line and ! a critical one.
Annotations
Notes on categories or dates: 2026-03: Price change; West: New region.
Expected range
On a line or area chart with one value, shades the range expected from the series' own history (a rolling average of the last 7 points ± 3 standard deviations, each point judged only against earlier ones) and marks the points outside it.
SQLly
Notebook chart editorNotebook chart editor
The chart editor: type, axes, aggregate, sort, date grouping, top N, formats, reference lines and annotations.

Export SVG e Export PNG save the chart as a file. Charts use a colour-blind-safe palette in both light and dark themes. Charts the report renderer draws (see below) look the same in the app and in exports; live charts are redrawn by that renderer when you export them.

Which chart to use

The suggestions follow these rules, so they're a good guide when you pick by hand too:

TipoUse it for
BarraA measure by category. Above 20 categories, keep the top 20 with Top N.
LinhaA measure over time; up to four measures, or one measure split into a few series.
ÁreaA measure over time where the total matters; best when values are never negative.
DispersãoTwo measures against each other, one point per row.
BubbleA scatter with a third measure as the point size.
HistogramaHow one measure's values are spread.
Pie, DonutShares of a whole: only for non-negative values and two to six slices, with no time axis.
Mapa de calorA measure across two categories (or a category and a date bucket).
Calendar heatmapA daily measure over two months to three years, one square per day.
WaterfallSigned changes that add up to a total, such as gains and losses by month.
FunnelOrdered stages that narrow (visits, sign-ups, purchases).
TreemapShares of a whole when there are too many categories for a pie.
Box plotHow a measure is spread within each of a few categories, with outliers.
Cohort retentionThe share of each starting cohort still active in later periods.
Correlation matrixHow three or more measures move together.
SparklineA small trend line with no axes, for a compact view.
KPI cardOne headline number with its change; use a KPI cell.

ID-like columns are never treated as measures. When the input is sampled or cut short, suggestions say so.

SQLly
Live bar and line charts in a notebookLive bar and line charts in a notebook
Two live charts: revenue by country as bars (largest first, top 12) and monthly revenue as a line.
SQLly
Heatmap, waterfall and funnel charts in a notebookHeatmap, waterfall and funnel charts in a notebook
A heatmap of revenue by category and country, a quarter-over-quarter waterfall and a customer funnel.
SQLly
Box plot, cohort retention and calendar heatmap chartsBox plot, cohort retention and calendar heatmap charts
A box plot of order line value by category, monthly cohort retention, and a calendar heatmap of orders per day.

Live charts and drawn charts

Bar, line, area, scatter, histogram, pie and donut charts are drawn live by the results grid's chart engine. Every other kind, and any of those seven using a setting the live engine lacks (reference lines, annotations, an expected range, stacked or horizontal bars, axis ranges, bubble size, colour by, shown values, an Other bucket, median or distinct count, smallest-first sorting), is drawn by the report renderer, the same renderer exports use. Which charts can be clicked to filter other cells is listed below.

Table cells

A Table cell shows its input in the same results grid as a query tab, so number and date formats, conditional colours, computed columns, frozen, hidden and reordered columns, sorting, column filters, selection statistics and the row form all work. Its settings are -- sqlly directive lines kept in the cell, the same lines you'd write above a query (see Diretivas do SQLly); arrange the grid and press its Lock button to write the current layout into the cell. The Pesquisar box ("Show rows containing…") is saved with the cell.

SQLly
Formatted table cell in a notebookFormatted table cell in a notebook
A table cell over order lines: currency formats, a revenue data bar, highlighted large discounts and a frozen first column.

Pivot cells

A Pivot cell builds a cross-tab of its input with the grid's pivot (see Pivô). Drag fields in the pivot sidebar, then press Save layout to keep the arrangement in the notebook. Double-click a value to see the rows behind it.

Table and pivot cells, like every other cell, can show only their output, and a pivot or chart can hide its sidebar to give the result the room. A SQL or table cell's own result grid can be locked to its rows, pivot or chart view. See Embedded outputs and report-style notebooks.

SQLly
Pivot cell in a notebookPivot cell in a notebook
A pivot cell of revenue by category and country, its layout kept in the cell.

KPI cells

A KPI cell is a row of up to eight tiles. For each tile, set:

Valor
An aggregate of a column (Sum, Average, Minimum, Maximum, Median, Count, Distinct count, Last value), the row count, or the first row's value.
Comparação
No comparison, Previous period (by day, week, month, quarter or year, when the input has a date column), Referência (another cell's result, such as last year's) or Destino (a number).
Direção
Higher is better, Lower is better, or Neutral.
Thresholds
Warning and critical levels on the Valor, o Alteração ou o Change %. The tile shows On track, Aviso ou Critical.
Sparkline
A small trend line, when the input has a date column. Over incomplete data it carries a small warning-coloured mark in its corner.

Over a cut-short or sampled input a tile still shows its number but withholds the status: "Status withheld: the input is incomplete". Previous period compares the latest period with the one before it.

SQLly
KPI scorecard tiles in a notebookKPI scorecard tiles in a notebook
A KPI row: revenue and orders against the previous month with sparklines and status, and customers against a target.

Click a chart to filter other cells

  1. On a table, chart, pivot or KPI cell, press Follow a chart and pick a chart cell. The button then reads "Follows by_category".
  2. Click a bar, point or slice in that chart. The following cells show only that category, with a chip: "Filtered by by_category: CategoryName = Beverages".
  3. Pressione Limpar filtro to see everything again.

Filtering happens on the rows already downloaded ("Local filter on downloaded rows; nothing is re-run."), so it is instant and never sends a query. It filters the same category labels and date grouping the chart shows. Clicking an Outros bucket filters nothing.

Which charts can be clicked

DrawnClickableNot clickable
Ao vivoBar, line, area, scatter, pie, donutHistogram (its bars are value ranges, not categories)
By the report rendererBar (vertical or horizontal, stacked or not), line, area, pie, donut, funnel, treemap, waterfall, including charts with reference lines, annotations or an expected rangeHeatmap, calendar heatmap, cohort retention, correlation matrix, box plot, histogram, scatter, bubble, sparkline
SQLly
Drawn bar chart with a reference line filtering the KPI tiles and table below itDrawn bar chart with a reference line filtering the KPI tiles and table below it
A bar chart with a target line is drawn by the report renderer, and clicking its tallest bar still filters the cells that follow it.
SQLly
Cross-filtered KPI and table cells following a bar chartCross-filtered KPI and table cells following a bar chart
Clicking the tallest bar filters the KPI tiles and the table that follow the chart, with the filter chip shown.

Where a chart's data came from

Every chart, table, pivot and KPI cell has the same toolbar:

View SQL
The SQL of its input, as the run builds it (references folded in), with Copy.
Lineage
The upstream cells it depends on, and for each input column the table column it came from ("computed or unclear" when SQLly can't tell).
Provenance
The connection, database, environment, when the data was extracted, the run id, how many rows were kept of the total, whether it is complete, and a hash of the SQL.
Open in Editor
Opens the input's SQL in a new query tab, without running it.
SQLly
Provenance panel of a notebook chartProvenance panel of a notebook chart
The provenance panel of a chart: connection, database, environment, extraction time, run id, rows kept and SQL hash.

These cells read their input from a snapshot of up to 100,000 rows (or the input's own row limit). When that isn't the whole result, a badge says so ("First 100,000 of 2,400,000 rows", "Sampled: 5,000 rows", "Partial result") with "Totals, charts and KPIs here cover only these rows, not the whole result." When the input is out of date, failed or still running, the cell says that too instead of showing an old picture as current.

A query that uses a formula value computed from a cut-short result is marked too, even though the query itself returned every row: charts and other cells reading it say "Computed from partial data". Drawn charts carry their badge inside the picture, so it stays on the chart in every export. A chart with more categories than it can show folds the rest into Outros rather than dropping them, and exports note how many were folded.

Limites

  • Heatmaps, calendar heatmaps, cohort retention, correlation matrices, box plots, histograms, scatter and bubble charts drawn by the report renderer, and live histograms, can't be clicked to filter.
  • A new KPI cell shows one tile over the first numeric column until you edit it.
  • In the browser build, Export SVG downloads the chart; Export PNG needs the desktop app.