Grouped Bar Chart
GroupedBarChartStrategy extends bar charts with a grouping variable that splits each
category into separate sub-bars. Supports stacked, relative (100 %), and horizontal layouts.
Constructor
from orama.strategies.grouped_bar import GroupedBarChartStrategy
strategy = GroupedBarChartStrategy(
fields_metadata=fields_metadata,
category_variables=["region"],
group_variable="product_line", # str — single categorical field for groups
aggregation=Aggregation(name="revenue", function="sum", field="revenue"),
stacked=False, # bool — stack bars instead of grouping
relative=False, # bool — relative % (requires stacked=True)
horizontal=False,
color_rules=None,
title=None, # str | None
subtitle=None, # str | None
caption=None, # str | None
description=None, # str | None — interpretive text (not in figure)
storytelling_context=None, # str | None — narrative goal / target audience
category_label=None, # str | None — axis label for the category
value_label=None, # str | None — axis label for the value
group_label=None, # str | None — legend title for the grouping variable
show_legend=True, # bool — show the figure legend
)
Supported colors
Selectors: ColorSelectorStrategy, ColorSelectByCategoryName.
Assigners: ColorAssignerByGroup.