Skip to content

toolkit: a chart's usage can stay honest about pace - #455

Merged
tannevaled merged 1 commit into
mainfrom
chart-threshold-overpace
Sep 6, 2026
Merged

toolkit: a chart's usage can stay honest about pace#455
tannevaled merged 1 commit into
mainfrom
chart-threshold-overpace

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

Summary

  • TimeSeriesChart gains Threshold ([]TimePoint) — a second reference series drawn as a dashed line, and OverInk (RGBA) — the color a Points segment switches to for any stretch ending above the Threshold in effect at that time. Motivating case: a quota-usage chart charting a "sustainable pace" line (the diagonal from window-start to window-reset), so a viewer sees at a glance whether current usage is on track to exhaust the quota before it resets, rather than having to eyeball two separate lines.
  • Also adds auto-scaled vertical gridlines (verticalGridInterval/verticalGridTicks) at a "nice" time interval — hourly for a short span, daily for a long one — alongside the existing three horizontal value gridlines, so the time axis reads at a glance.
  • Rebased onto toolkit: a chart's series can be bound #453 (bindable Series) and toolkit: a chart can follow its own peak #454 (FollowPeak/NiceCeiling), both of which restructured Draw around c.points() — this reapplies cleanly against that shape.

Test plan

🤖 Generated with Claude Code

…cal gridlines

TimeSeriesChart gains Threshold ([]TimePoint, a second reference series
drawn as a dashed line) and OverInk (the color a Points segment switches
to for any stretch ending above the Threshold in effect at that time) —
for a caller charting quota usage against the pace that would exhaust it
exactly at reset, materializing whether it's on track rather than
requiring a visual comparison.

Also adds vertical gridlines at an auto-picked "nice" time interval
(hourly for a short span, daily for a long one, via
verticalGridInterval/verticalGridTicks) alongside the existing three
horizontal value gridlines, so the time axis reads at a glance without
depending only on the two start/end labels.

Rebased onto #453 (bindable Series) and #454 (FollowPeak/NiceCeiling) —
both land in Draw's own body, so this reapplies cleanly against
c.points() rather than the old direct c.Points access.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tannevaled
tannevaled merged commit f2ce7ca into main Sep 6, 2026
1 check passed
@tannevaled
tannevaled deleted the chart-threshold-overpace branch September 6, 2026 09:49
tannevaled added a commit to go-aiquota/tray that referenced this pull request Sep 6, 2026
Materializes whether usage is running ahead of the pace that would
exhaust a window's quota exactly at its reset, per live user feedback:
each panel's curve now turns red for any stretch above the diagonal
from window-start to reset (toolkit.TimeSeriesChart's new
Threshold/OverInk, go-widgets/toolkit#455 / v0.310.0), computed from
ResetsAtUnix + menubar.SeriesWindowDuration. Also picks up that
release's auto-scaled vertical gridlines (hourly/daily) on the time
axis, another live request.

Live-verified against the real, already-running app's own history data
(184 real polled points): the reference line and red/green recoloring
render correctly, including across a real session reset. Older points
recorded before ResetsAtUnix was captured (#11) have no
threshold to compare against and simply carry no Threshold sample near
them — an expected, self-resolving gap as that history ages out.

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