flexmeasures.data.services.annotations

Functions

flexmeasures.data.services.annotations.prepare_annotations_for_chart(df: pd.DataFrame, event_starts_after: datetime | None = None, event_ends_before: datetime | None = None, max_line_length: int = 60) pd.DataFrame

Prepare a DataFrame with annotations for use in a chart.

  • Clips annotations outside the requested time window.

  • Wraps on whitespace with a given max line length

  • Stacks annotations for the same event

flexmeasures.data.services.annotations.stack_annotations(x: DataFrame) DataFrame

Select earliest start, and include all annotations as a list.

The list of strings results in a multi-line text encoding in the chart.