Guide · Doing
Chart a query result
A grid of about 120 rows tells you each day's count per channel. It does not show you whether web orders dip at weekends while the other three channels hold steady. Open a chart when the question is about shape: a trend over days, which of 40 stores carries the revenue, how order totals spread. Stay in the grid when you need exact values or the row behind one.
Draw the chart
Run an aggregate in a SQL tab. Orders per day for the last 30 days, split by channel:
SQLSELECT date_trunc('day', placed_at) AS day, channel, count(*) AS orders FROM commerce.orders WHERE placed_at >= now() - interval '30 days' GROUP BY 1, 2 ORDER BY 1;The result pane shows
Result,ChartandPlan.Chartcarries a small sparkline of what it would draw. When the result has nothing to chart, the button is dimmed and its tooltip saysNothing to chart.Click
Chart. Seqora draws a line per channel:dayon the X axis,ordersup the side, one coloured series for each of the four channels and a legend above the plot.Hover the plot. A dashed line snaps to the nearest day, and a card lists that date and each channel's count. Axis labels are compact (
12k,1.5M). The card shows the full value.
The x, y and split chips read day, orders and channel. Line is pressed.
Change the chart with the chips in the header.
xpicks the axis column,ypicks the measure,splitpicks the column whose values become series, orNone. The type buttons switch betweenLine,Area,Bar,Scatter,NumberandHistogram. With a split,AreaandBarstack the channels.Click a channel in the legend to hide it. The axis rescales to what is left. Click it again to bring it back.
Copy the chart with
Copy image(a PNG at twice the size on screen) orCopy SVG. The copy carries a title,orders by dayhere, the visible legend entries, and a footer with the connection name and the time you copied it. The hover line and card are left out.
Run the query again and the chart keeps your choices, as long as the result has the same column names. Change the columns and Seqora picks again. The choices last until you quit Seqora. A tab that was on Chart stays on Chart when you run it again.
How Seqora picks what to draw
Seqora reads the column types and a sample of up to 200 cells per column. Each column becomes one of four things:
| Column | Counts as | Example |
|---|---|---|
date, timestamp, timestamptz |
time | day |
integer, numeric, float |
number | orders, revenue_cents |
| text, boolean | category | channel, store |
time, interval, jsonb, anything else |
not charted |
A text column where every sampled cell is an ISO date counts as time, so to_char(placed_at, 'YYYY-MM-DD') charts as dates. A number column counts only when 90% of its sampled cells parse as numbers.
Then it picks the first rule that fits:
- One row, no time column:
Number, each measure as a large figure. - A time column:
Lineover time. A category column with 12 or fewer distinct values becomes the split. - A category column:
Bar, one bar per value, in the order the query returned them. - Two number columns:
Linewhen the first one ascends,Scatterwhen it doesn't. - One number column, many rows:
Histogramof its values.
A number column named id or ending in _id, such as store_id, is not picked as the measure. It counts rows and measures nothing.
Revenue by store shows the bar rule:
SELECT s.name AS store,
sum(o.total_cents) AS revenue_cents
FROM commerce.orders o
JOIN commerce.stores s ON s.id = o.store_id
GROUP BY s.name
ORDER BY revenue_cents DESC;
commerce.stores has 40 rows under 24 names, so the chart draws 24 bars. A bar chart draws at most 30. Past that, Seqora keeps the 30 categories with the largest totals and the header says how many it kept out of how many there were.
A type button that doesn't fit the columns stays dimmed, and its tooltip says why: Histogram: A histogram needs at least two rows to show a spread., Number: Big numbers show a single row or a time series. Number on a time series shows the latest value with a sparkline under it.
When there is nothing to chart
A result with no number column, such as SELECT email, country FROM crm.customers, has nothing to measure. Chart stays dimmed. If the tab was already on Chart when you ran it, the view says Nothing to chart and Charts need a number column, with a time or text column to plot it against.
Caveats
- The chart reads at most 10,000 rows. Past that it draws the first 10,000 and the header says
10,000 of N rows. The result itself keeps 10,000 rows by default (see the row cap), so aggregate in SQL rather than charting raw rows. - A filter in
Resultnarrows the chart too. The header then readsN of M rows. - Rows that share an X value are added together, and a
Σmark appears withRows with the same day are summed. Group in the query if you meant something other than a sum. - A split draws at most eight series. The values with the smallest totals fold into one series called
other.ydraws at most six measures, andAll numberspicks them all. - A NULL measure leaves a gap in a line or area, so a missing day reads as missing. A NULL time or number on the X axis drops that row. A NULL category becomes a bar labelled
NULL. - Times are plotted as the database printed them, in the session time zone. A daylight saving change inside the range can shift a point by an hour.
- Charts work on SQL results on every engine Seqora connects to. A table tab has no
Chart. Run aSELECTinstead, or watch the table to see its rows change.