Skip to content

Charts

The Chart view of the results card draws a workspace's result as a bar, line, or scatter chart. A bar or line chart groups the rows by one column and plots one value per group. A scatter plots one dot per row. You can see the shape of a result without leaving Explore, and the Explore Assistant can propose a chart for you.

What the Chart Draws

The chart draws the rows the results have loaded so far, never the whole result, and it never runs the query again. While more rows are left to load, the bottom of the settings panel says Charts the N rows loaded so far. and offers two buttons:

  • Load more reads the next 1,000 rows of the result.
  • Load all reads rows until the chart holds up to 50,000. Its tooltip reads Up to 50,000 rows.

The rows these buttons read load into the result, so Results shows them too. Scrolling Results also loads more rows, and the chart takes them in when you come back to Chart.

To chart every row of a large result, group it in the SQL instead, for example with GROUP BY, so the result itself is small enough to load in full.

The Chart view is available in workspaces on the Explore page and on a datastore's Explore tab. A table's Explore tab has no chart.

Chart Settings

Setting Options Default
Chart type bar , line , or scatter bar, or line when the X axis is a date
X axis Any column of the result. A scatter takes number columns only. See Defaults
Group by by day, by week, by month, by quarter, by year. Shown only when the X axis is a date. Follows the span of the dates
Y axis Any number column of the result. With count distinct, any column. See Defaults
Combine with sum, average, min, max, count, count distinct sum, or count when the result has no number column
Sort The X column or the value, in either direction The X column, ascending

The chart keeps its settings when you switch to Results or History and back. A new run keeps the axes you picked as long as those columns are still in the result.

Defaults

The chart starts from the settings that best fit the result:

  • X axis: the column the query groups by, with a date first, when the SQL can be read. Otherwise the first date column, then the text column with the fewest distinct values (as long as it makes between 2 and 20 groups), then the first text column, then the first column.
  • Y axis: the query's own aggregate, such as SUM(amount), when the SQL can be read. Otherwise a number column named like a measure (such as amount, total, price, quantity, revenue, or score), then any other number column.
  • Columns that identify rows are never the default Y axis: names such as id, customer_id, order_key, country_code, or order_no, and whole numbers that never repeat across 10 or more rows. Adding them up means nothing.

The query's own grouping is read from its outermost GROUP BY, whether it names a column, an alias, or a position, and from the aggregate functions it selects. A query built with UNION or SELECT * gives the chart no grouping to follow, so the chart picks from the columns alone.

When the result has no number column, the Y axis field is disabled and says No number columns, so rows are counted, and only count and count distinct are offered.

Settings Panel

The settings panel sits to the right of the chart when the results card is wide enough. Drag its left edge to resize it: it stays between 260 and 520 pixels wide, and the chart keeps at least 480. Your browser remembers the width.

On a narrow results card, the panel leaves the side of the chart, and a Chart settings button above the chart opens the same settings in a menu.

Chart Types

Bar and Line

A bar or line chart groups the rows by the X axis: every distinct value of that column becomes one bar, or one point on the line. Rows where the column is empty form their own group, labeled null. Each group's value comes from the Y axis, combined as set under it. See Combining Rows.

Dates on the X Axis

When the X axis is a date or a timestamp, the chart turns into a line, and its rows group by a span of time: by day, by week, by month, by quarter, or by year. The span starts from the range of the dates:

Range of the dates Default span
Up to 31 days by day
Up to about 6 months by week
Up to about 3 years by month
Up to about 10 years by quarter
Longer by year

Every span between the first date and the last is drawn, including the ones with no rows, so the line runs through the gaps instead of skipping them. Each span keeps its year, so January 2024 and January 2025 stay apart. You can switch the chart back to a bar chart.

Scatter

A scatter puts a number column on each axis and draws one dot per row, so a dot far from the rest is a value worth a look. It is offered only when the result has at least two number columns. Under Y axis, the panel says Both axes take number columns. Each row is a dot, so a dot far from the rest is a value worth a look.

A scatter has no way of combining rows and no sort. A row without a number on both axes has no dot, and a scatter draws at most 5,000 dots.

Combining Rows

On a bar or line chart, rows that share an X value are combined into one value. The chips under Y axis pick how:

Option Value of each group
sum The total of the Y column.
average The average of the Y column, over the rows where it holds a number.
min The smallest value of the Y column.
max The largest value of the Y column.
count The number of rows. The Y axis is not used.
count distinct The number of distinct values of the Y column. The Y axis can then be any column.

Empty and non-number Y values are left out of sum, average, min, and max.

Results Already Grouped

When each X value holds a single row, for example when the query already groups by the X column, there is nothing to combine. The chart shows each value as the query returned it, and the panel says One row per <X>, shown as it is (or One row per month, shown as it is for a date grouped by month) instead of the ways of combining. A date grouped into a longer span, such as days into months, still combines its rows.

Sorting

The Sort options name what they order and read in its terms:

Option Example
The X column, ascending or descending region, A to Z for text, order_date, oldest first for a date, quantity, low to high for a number
The value, high to low or low to high Sum of amount, high to low, Rows, low to high

Many Values on a Bar Chart

A bar chart shows at most 20 bars. When the X column has more distinct values, the chart keeps the 19 groups with the highest values and folds the rest into one Other bar, which stays last whatever the sort. The caption then adds Top 19 of N values, the rest in Other. A date X axis never folds, and a line chart shows every value.

Long Names

When a bar's name is longer than 18 characters, the bars turn sideways, so each name reads along the chart's width. A sideways name is shortened in the middle past 48 characters. Each sideways bar keeps its height, so many bars make the chart taller, and the panel scrolls. On the other charts, names longer than 18 characters are shortened in the middle on the axis. The tooltip always shows the full value.

Title and Caption

The chart's title names what it plots, with each column shown as a chip with its type:

  • Sum of <Y> by <X>, and likewise with Average, Min, Max, or Count distinct.
  • Rows by <X> when it counts rows.
  • <Y> by <X> when the values are shown as returned.
  • A date X axis adds its span, for example Sum of amount by order_date by month.
  • <Y> against <X> on a scatter.

The caption beside it names the basis, for example Sum, from the 100 rows loaded so far, or As returned, from the 12 rows loaded when the values are shown as returned. The words so far appear while more rows are left to load. On a scatter it reads One dot per row, from the N rows loaded, or One dot per row, D of the N rows loaded when some rows have no dot.

Suggest a Chart

Suggest a chart sits next to Chart type, when AgentQ is set up with a data level above Nothing about your data, on screens wide enough to dock the assistant. It asks the Explore Assistant for a chart that fits the result, and tells it which chart shows now. The assistant answers with a Proposed chart card, and Apply on the card draws it.

The Explore Assistant can also propose a chart along with a query, which is drawn once that query runs. When a proposed chart is applied, the results open on Chart, and the settings it changed are highlighted in purple until you click or move into the settings. See Explore Assistant and Apply a Proposed Chart.

Downloads

The Download the chart button on the results bar offers two files, both named after the workspace and drawn in light colors on white, whatever the theme:

Option What the file holds
Chart, as PNG An image with the workspace name, the run's details (datastores, SQL, rows, who ran it, when it ran, when it was exported), and the chart.
Report, as PDF An A4 report with the same header and chart, then a Data table with each X value and its value (each dot's X and Y on a scatter), and the Query that ran.

When the chart is built from part of the result, both files say so under the details, for example Based on the first 100 rows of 2,500. The whole result may differ. A result that ended at its size limit reads Based on the first N rows, where the result stopped at its size limit.

The download button does not appear when downloads are turned off for your deployment. If a download fails, an error message appears: Could not download the chart. See Chart the Results.

Empty States

A chart needs rows. Until a run returns some, the Chart view shows what Results shows:

Situation What the Chart view shows
No run yet Run a query to see its results
A run with no rows No rows returned
A failed run The error, with Copy error and Fix with AgentQ
A stopped run Query stopped
A result with no number column A chart that counts rows, with No number columns, so rows are counted under Y axis.

A chart with nothing to draw reads Run a query that returns rows to chart them.


See Also