Stacked bar chart
A stacked bar chart shows how segments add up within each category — for example revenue by product stacked per month.
The important setting is data layout. It has to match how the query returns rows.
Category (X-axis)
categoryField is the shared axis — month, region, or another grouping that every stack belongs to.
Data layout
Choose one:
Wide — multiple value columns
Each stack segment is its own column on the same row.
SELECT month, product_a, product_b, product_c
FROM monthly_revenue
WHERE account_id = :customer_id
ORDER BY month
Map Values to stack (valueFields) to product_a, product_b, and product_c.
Long — series + value columns
Each row is one segment: a category, a series name, and a number. This is the usual shape of a GROUP BY category, series query.
SELECT month, product, SUM(amount) AS revenue
FROM invoices
WHERE account_id = :customer_id
GROUP BY month, product
ORDER BY month
Map Series (stack groups) (seriesField) to product and Value (valueField) to revenue.
The editor treats the chart as long-format when both seriesField and valueField are set. Switching to wide clears those fields; switching to long clears valueFields.
Chart options
- Horizontal — stacks go left to right.
- Show legend — default on, so viewers can read segment colors.
Related
- Stacked line chart for the same layouts as an area/line stack
- Bar chart for grouped (not stacked) bars
- Pivot table when you need the numbers in a grid