Skip to content

Default period to x-axis filtering and add Filter values to period option - #26

Merged
adampeterhiggins merged 2 commits into
mainfrom
ah/period-x-axis-range-filter
Nov 25, 2026
Merged

adampeterhiggins merged 2 commits into
mainfrom
ah/period-x-axis-range-filter

Conversation

@adampeterhiggins

@adampeterhiggins adampeterhiggins commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Summary

Makes x-axis-only filtering the default behaviour for the Period filter on cumulative and percentage-share graphs (preserving underlying calculations across all history), and adds an opt-in "Filter values to period" toggle (default off) in the Period dropdown for recalculating using only records within the selected period.

Changes

  • State & Scope (src/lib/state/app.ts, src/lib/hooks.ts)
    • Added persisted periodFilterValues toggle in useApp (default false, localStorage key github-monitor.periodFilterValues).
    • Extended Scope with xAxisOnly (!periodFilterValues), dataRange, dataFromDay, dataToDay, and dataKey, plus useDataRange on useScopedQuery so x-axis-only period changes reuse cached all-time query results without re-querying SQLite.
  • Period Dropdown UI (src/components/FilterBar.tsx)
    • Added a "Filter values to period" checkbox (default off) with helper text at the bottom of the Period dropdown.
    • Shows (values) on the Period button and · values filtered on the range summary when enabled (for non-"All time" periods).
  • Series Slicing (src/lib/agg/series.ts)
    • Added bucketNextStart and sliceAxisRows to filter already-rolled-up / cumulative rows to buckets overlapping [fromMs, toMs] across day, week, month, and quarter granularities.
  • Charts (src/pages/Contributors.tsx, src/pages/Traffic.tsx)
    • Contributors: computes buildStacks, rollUp, toCumulative, and contributor card totals/charts across all history by default, then slices the plotted x-axis rows (and respects brush zoom on cards). When Filter values to period is checked, reverts to period-scoped calculations.
    • Traffic: computes Referrer share over time top-8 series ranking and Other fold across all history by default, then slices the plotted x-axis days to the selected period.
    • (LineOwnership already computes history over all time and slices the x-axis.)
  • Tests (scripts/test-queries.mjs)
    • Added unit tests covering sliceAxisRows, bucketNextStart, cumulative preservation, cumulative share preservation, year rollovers, out-of-range windows, and daily boundaries.

Verification

  • npm run check (typecheck, query tests, line-ownership tests, theme tests, workflow lint) — passed
  • npm run build — passed

adampeterhiggins and others added 2 commits November 25, 2026 12:57
Co-authored-by: Cursor <cursoragent@cursor.com>
…to period toggle

Co-authored-by: Cursor <cursoragent@cursor.com>
@adampeterhiggins adampeterhiggins changed the title Add x-axis-only period filter option for cumulative and share charts Default period to x-axis filtering and add Filter values to period option Nov 25, 2026
@adampeterhiggins
adampeterhiggins merged commit 95c3452 into main Nov 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant