Skip to main content

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

Put the category in the first column and the value(s) after it:

SELECT
country AS "Country",
COUNT(*) AS "Customers"
FROM customers
GROUP BY country
ORDER BY COUNT(*) DESC;

Country becomes the category axis and Customers becomes the bars.

Multiple series

Add more numeric columns 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 numeric column is drawn as its own set of bars, grouped by region.

Tips

  • Use ORDER BY to sort bars by size — it makes the chart much easier to read.
  • Switch to horizontal bars when you have many categories or long labels.
  • For a value that is on a very different scale (such as a percentage alongside a total), consider a mixed chart instead.