Skip to content

No way to ask about a sub-period: add a date-range window the tables follow #78

Description

@tschm

The app draws the whole file, always. The first question two NAV series invite is about a
stretch of it — what did these two do in 2022 — and today the only way to ask is to leave
the app and refilter the parquet.

Everything needed is already in place. columns.date_column knows whether there is a date
axis or row numbers; aligned sorts by period; plot and stats both consume the same
aligned frame. What is missing is one input.

Shape. A range control in the middle column, under the rebase switch: mo.ui.date_range
when date_column(frame) is not None, mo.ui.range_slider over the row index when it is.
Filter once in the cell that already derives pair and chart, and let both the chart and
the two summary tables come off the filtered frame.

Why a range control and not an Altair brush. alt.selection_interval(bind="scales")
would be fewer lines, and it would break the repo's own invariant: zooming the axis moves
the picture and leaves the tables describing the full sample, which is the exact failure mode
of #75 reintroduced deliberately. A range input filters the data, so the tables follow and
"the numbers beside the chart always describe the lines in it" keeps holding. Getting a
brush to filter instead of zoom needs mo.ui.altair_chart for the round trip, which also
means line_chart stops being the plain Altair chart that plot.py's docstring promises —
worth knowing before reaching for it.

Two things fall out for free once the window exists:

Sequencing: after #75. Building a window on a caption that already misreports its sample
means writing the fix twice.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions