Skip to content

Pie Chart

PieChartStrategy renders a circular chart where arc length is proportional to the aggregated value. Setting hole > 0 produces a doughnut chart.

Constructor

from orama.strategies.pie import PieChartStrategy

strategy = PieChartStrategy(
    fields_metadata=fields_metadata,
    category_variables=["region"],
    aggregation=Aggregation(name="count", function="count"),
    sort_by_value=SortOrder.NONE,
    hole=0.4,                               # float in [0, 0.9] — doughnut hole fraction; 0 = full pie
    inner_overall=0.0,                      # float — font size for the overall value in the hole; 0 = hidden
    inner_overall_label=None,               # str | None — text label rendered below the overall value
    inner_overall_human_readable=False,     # bool — format overall value as compact shortform (e.g. 1.2k, 3d 12h)
    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 — reserved for future legend/hover use
    value_label=None,     # str | None — reserved for future legend/hover use
    show_legend=True,     # bool — show the figure legend
)

When hole > 0 and inner_overall > 0, get_query_params() returns both a "main" and an "overall" key. inner_overall_label and inner_overall_human_readable only take effect when inner_overall > 0.

Supported colors

Selectors: ColorSelectorStrategy, ColorSelectByCategoryName, ColorSelectValuesBelow, ColorSelectValuesAbove, ColorSelectMaxValue, ColorSelectMinValue.

Assigners: ColorAssignerByCategory, ColorAssignerByValue.