Stacking

Grouping series together to show relationships to part of a whole

Stacking refers to combing series values into a single value while retaining their name. It is useful when you want to compare values as part of a whole. Certain chart types support stacking, they are: line, area, column, bar and combo.

Adding @stacks

Stacking is enabled for a chart by specifying the @stacks directive

-- @chart: column
-- @title: Stacking - Example column chart with stacking
-- @groups: Month, Channel
-- @subtitle: An example column chart that has a single stack
-- @formats: currency
-- @series: Sales
-- @stacks: Channel
SELECT 
	TRUNC(date_closed, 'MONTH') as Month,
    Channel,
	sum(amount) as Sales
FROM sales
GROUP BY TRUNC(date_closed, 'MONTH'), Channel
ORDER BY TRUNC(date_closed, 'MONTH') ASC;

Stacking Examples

Last updated

Support

DiscordX

ChartSQL