Charts
Kvery can render your query results as a chart instead of a table. Charts are a fast way to spot trends and compare values, and they work on dashboards just as well as in the editor.
Available chart types
| Chart | Page | Good for |
|---|---|---|
| Vertical bar | Bar charts | Comparing values across categories |
| Horizontal bar | Bar charts | Category labels that are long |
| Line | Line chart | Trends over time |
| Mixed (bar + line) | Mixed chart | Bars and a line on the same scale (e.g. actual vs. target) |
| Pie | Pie & doughnut | Share of a whole |
| Doughnut | Pie & doughnut | Share of a whole, with a centre |
How a chart is built from your rows
Kvery does not pick the columns by itself: you choose them in the Chart view settings window.
- Chart type — Vertical bar, Horizontal bar, Line, Mixed, Pie or Doughnut.
- X axis values — the column whose values label the categories (or the time axis).
- Add dataset — adds a dataset with a Label (its name in the legend), a Color and a Datasource: the column whose values it plots. Add one dataset for each series.
- Stacked? — stack the datasets on top of each other.
- X axis name and Y axis name — titles of the axes.
- Animation? — animate the chart when it is drawn.
- Show labels? — write the values on the chart.
Stacked?, X axis values, the axis names and Animation? are not offered for Pie and Doughnut charts. A Line chart offers an Area option per dataset (fill the area below the line); a Mixed chart offers a Chart type (Line or Bar) per dataset, and Area for its line datasets.
So for a query like:
SELECT month, revenue, orders
FROM monthly_sales
ORDER BY month;
choose month as X axis values and add two datasets, one with revenue and
one with orders as its Datasource.
Switching to a chart
Run the query, then choose Chart view (the chart only) or Chart and table view (the chart above the table) in the layout selector of the result. If the query has no chart settings yet, the Chart view settings window opens; Save draws the chart, and when you can edit the query, it saves the layout and the settings with the query (for other users the chart lasts until the page is loaded again). On the query's run page and its shared page, the Chart settings button above the chart opens the settings again; it is not shown in a frame, in a dashboard tile, in the Kvery mobile app or while the table refreshes automatically. The chart is drawn from the rows already returned, in the order of the table, from its visible columns.
Working with a chart
The toolbar above the chart zooms into an area, restores the original view and
saves the chart as an image (chart.png); pie and doughnut charts offer only the
image. Bar, line and mixed charts also have a zoom slider. Point at a bar, a point
or a slice to see its value and its share of the total; with several datasets the
tooltip also shows their total. The toolbar is not shown in the Kvery mobile app.
Tips for good charts
- Aggregate in SQL. Chart a handful of grouped rows (
GROUP BY), not thousands of raw rows — it is faster and far easier to read. - Order the labels with
ORDER BYso a time axis reads left-to-right. - Hidden columns (
hidden::) are not offered as X axis values or datasources. - Name your columns with
AS— the aliases are the names you pick from in the chart settings.