toolkit: a chart can follow its own peak - #454
Merged
Merged
Conversation
A fixed ceiling is wrong in both directions on live data. Too low and a burst is drawn off the top, where nobody can measure it; too high and everything else is a flat line along the bottom. FollowPeak makes the chart choose its own Max: up to a new peak AT ONCE, so a burst is never drawn off the top, and down by a fifth of the distance per draw, so a quiet minute lowers the scale and a single quiet sample does not. A ceiling that simply tracked the peak would rescale the whole picture every time a spike scrolled off the left, and a graph whose axis keeps moving cannot be read at all. NiceCeiling rounds to a power of two or to a half or three quarters of one — 1, 1.5, 2, 3, 4, 6, 8 — because those are the gradations a quantity is spoken in, and two charts sharing a scale then land on the same marks. Approaching by fifths never arrives, so a ceiling within a thousandth of its target takes it: otherwise the axis reads 1.0000000000000004 for ever. Opt-in. A chart nobody asked to follow anything keeps the bounds it was given. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
3 tasks
tannevaled
added a commit
that referenced
this pull request
Sep 6, 2026
…cal gridlines (#455) 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A fixed ceiling is wrong in both directions on live data. Too low and a burst is drawn off the top, where nobody can measure it; too high and everything else is a flat line along the bottom.
FollowPeakmakes the chart choose its ownMax: up to a new peak at once, so a burst is never drawn off the top, and down by a fifth of the distance per draw, so a quiet minute lowers the scale and a single quiet sample does not. A ceiling that simply tracked the peak would rescale the whole picture every time a spike scrolled off the left — a graph whose axis keeps moving cannot be read at all.NiceCeilingrounds to a power of two or to a half or three quarters of one (1, 1.5, 2, 3, 4, 6, 8): the gradations a quantity is spoken in, so two charts sharing a scale land on the same marks.Approaching by fifths never arrives, so a ceiling within a thousandth of its target takes it — otherwise the axis reads
1.0000000000000004for ever.Opt-in: a chart nobody asked to follow anything keeps the bounds it was given.
🤖 Generated with Claude Code