Bar Charts
Bar charts compare a numeric value across a set of categories. Kvery offers two orientations:
- Vertical bar — bars rise from a category axis along the bottom. This is the default and works well for most comparisons.
- Horizontal bar — bars extend from a category axis down the side. Choose this when your category labels are long, since they have room to read across.
Building a bar chart
Return the category and the value(s) as columns:
SELECT
country AS "Country",
COUNT(*) AS "Customers"
FROM customers
GROUP BY country
ORDER BY COUNT(*) DESC;
In the chart settings choose
Vertical bar or Horizontal bar, pick Country as X axis values (the
category axis) and add a dataset with Customers as its Datasource (the bars).
In a horizontal bar chart the category axis is the vertical one: X axis name
titles that vertical axis and Y axis name the horizontal value axis.
Multiple series
Return more numeric columns and add a dataset for each to compare several values per category side by side:
SELECT
region AS "Region",
SUM(revenue) AS "Revenue",
SUM(refunds) AS "Refunds"
FROM sales
GROUP BY region
ORDER BY region;
Each dataset is drawn as its own set of bars, grouped by region; set Stacked? to Yes to stack them instead.
Tips
- Use
ORDER BYto sort bars by size — it makes the chart much easier to read. - Switch to horizontal bars when you have many categories or long labels.
- To draw some datasets as lines, use a mixed chart. All datasets share one value axis, so chart values of a similar scale together.