Skip to content

story

story

story(
    data: Any,
    text: str,
    time: str = "time",
    *,
    lane: str | None = None,
    color: str | None = None,
    palette: Mapping[Any, str]
    | Sequence[str]
    | None = None,
    symbol: str | None = None,
    importance: str | None = None,
    stem_shape: Literal["straight", "curved"] = "straight",
    label_width: float | None = None,
    tooltip: Sequence[str] | None = None,
    title: str = "",
    height: int = 420,
    today: Any = None,
) -> Timeline

A story timeline: each event on a line, its text in a box above or below it, joined by a line (a stem); the boxes take as many levels as they need so none overlap, at every zoom. For a few dozen to a few hundred events whose text matters: an incident, a release history, a project's history.

Parameters:

  • data (Any) –

    A table with a row per event.

  • text (str) –

    The text of each event: a column, or a template such as "{time:%H:%M}\n{title}" (a line break gives the box two lines).

  • time (str, default: 'time' ) –

    The column of times.

  • lane (str | None, default: None ) –

    A column of lanes: a story line per lane (by default, one).

  • color (str | None, default: None ) –

    A column to color the events by (a kind, a severity), or one colour.

  • palette (Mapping[Any, str] | Sequence[str] | None, default: None ) –

    Colours for the categories of color.

  • symbol (str | None, default: None ) –

    A column to give the events' marks shapes by.

  • importance (str | None, default: None ) –

    A numeric column: when the boxes do not fit, the more important keep theirs.

  • stem_shape (Literal['straight', 'curved'], default: 'straight' ) –

    "straight" stems (each box over its event) or "curved" ones (a box may move aside, its stem bending), which fits more boxes where events crowd.

  • label_width (float | None, default: None ) –

    The widest a box gets, in pixels; longer titles wrap onto two lines. By default 16 × the text size; 0 for no limit.

  • tooltip (Sequence[str] | None, default: None ) –

    Columns shown when hovering an event or its box.

  • title (str, default: '' ) –

    Shown above the timeline.

  • height (int, default: 420 ) –

    Height in pixels.

  • today (Any, default: None ) –

    A time to mark with a line labelled "today" (e.g. datetime.now()).

Returns:

  • Timeline –

    The timeline: show it as the last expression of a cell.