Skip to content

toolkit: a chart can follow its own peak - #454

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

toolkit: a chart can follow its own peak#454
tannevaled merged 1 commit into
mainfrom
chart-autoscale

Conversation

@tannevaled

Copy link
Copy Markdown
Contributor

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 — 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): 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.0000000000000004 for ever.

Opt-in: a chart nobody asked to follow anything keeps the bounds it was given.

🤖 Generated with Claude Code

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>
@tannevaled
tannevaled merged commit 5555320 into main Sep 6, 2026
2 checks passed
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>
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