Skip to content

toolkit: TimeSeriesChart can pin its time axis to a full window - #457

Merged
tannevaled merged 1 commit into
mainfrom
timeserieschart-pinned-range
Sep 6, 2026
Merged

toolkit: TimeSeriesChart can pin its time axis to a full window#457
tannevaled merged 1 commit into
mainfrom
timeserieschart-pinned-range

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Summary

  • TimeSeriesChart's time axis auto-derives from Points[0].At/the last point's At — fine once a series has real history, wrong for a fresh chart backed by only a few hours of data that's meant to always represent a full period (a rolling 7-day view, say). Live user feedback: a weekly usage chart backed by ~21 hours of real history rendered as a ~21-hour chart, not a mostly-empty week.
  • Adds TimeMin, TimeMax int64 (ignored unless TimeMax > TimeMin) to pin the displayed span explicitly — mirroring Min/Max's own existing "always taken as given, never auto-derived" convention for the value axis, just applied to the time axis too.
  • Vertical gridlines and the two axis-end labels now render against the pinned window even with zero or one real point; the curve itself is unaffected (still needs 2+ points to draw anything).

Test plan

  • go build ./..., go vet ./..., gofmt -l . clean
  • go test ./... green across the whole repo, zero regressions — every prior TimeSeriesChart test (including anti-aliasing/Threshold/FollowPeak/Series-binding from toolkit: a chart's series can be bound #453-456) passes unchanged
  • Every function at 100% coverage

🤖 Generated with Claude Code

Points' own first/last At auto-derives the displayed span today, which
means a chart backed by day-old history renders as a one-day chart, not
a mostly-empty week — wrong for a caller that wants to always show a
full period (a rolling 7-day view, say) from the very first render, not
one that only ever covers however much data happens to have
accumulated.

TimeMin/TimeMax (ignored unless TimeMax > TimeMin) let a caller pin the
axis explicitly, mirroring Min/Max's own existing "always taken as
given, never auto-derived" convention for the value axis. The curve
itself is unaffected — still nothing drawn with fewer than two points —
but the axis scaffolding (vertical gridlines, end labels) now renders
against the full pinned window even with zero or one real point yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit d1636fb into main Sep 6, 2026
1 check passed
@tannevaled
tannevaled deleted the timeserieschart-pinned-range branch September 6, 2026 13:04
tannevaled added a commit to go-aiquota/tray that referenced this pull request Sep 6, 2026
…#15)

Live user feedback: the weekly panel only shows ~21 hours since that's
all the app has been running — it should show a full 7 days from the
very first render, growing fuller as real data accumulates, not a
window that only ever covers whatever history happens to exist yet.

Picks up go-widgets/toolkit#457 (TimeMin/TimeMax) and pins each chart's
displayed time axis to [now - SeriesWindowDuration, now] — the session
panel always shows its own 5h window, weekly always shows its own 7
days, recomputed on every refresh so both windows slide forward with
real time.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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