Skip to content

Line Chart

LineChartStrategy plots one line per category value over a time axis grouped by calendar year and month. The date_variable must be a datetime field whose __year and __month derived fields are present in the fields_metadata map.

Constructor

from orama.strategies.line import LineChartStrategy

strategy = LineChartStrategy(
    fields_metadata=fields_metadata,
    date_variable="created_at",             # str — a date or datetime field (DateTimeVariable)
    aggregation=Aggregation(name="count", function="count"),
    category_variable="status",             # str | None — splits data into lines
    min_value=None,
    max_value=None,
    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
    date_label=None,                        # str | None — X-axis label for the date dimension
    value_label=None,                       # str | None — Y-axis label for the value
    category_label=None,                    # str | None — legend title (when category_variable is set)
    show_legend=True,                       # bool — show the figure legend (no effect in ridgeline mode)
)

get_query_params() groups by created_at__year, created_at__month, and status.

Supported colors

Selectors: ColorSelectorStrategy, ColorSelectByCategoryName.

Assigners: ColorAssignerByCategory.