fix: the x labels go relative on what a label can write, not on the span
A `t0 = ...` caption appeared on every sub-second window, including a triggered one whose axis is already relative to the edge -- so the ticks were re-anchored away from the one position a triggered axis exists to show, and the caption had nothing to explain. The form is now decided by the tick step against `TickFormat::Time`'s own resolution at the axis' magnitude (three significant figures below a minute, whole seconds through `m:ss` to a day, three figures of days above). The span said nothing about that and was wrong both ways: a 2 s window at twenty minutes of uptime reads `20:00` on every tick and stayed absolute. The step is read back from the last layout's majors (a tick value depends on the range and the axis width, not on the label form); with no ticks yet the form is left alone rather than guessed, since the hysteresis would latch a guess. Entering the relative form carries a ULP of slack, because `step == res` is readable and a bare comparison of two differently computed doubles flipped the form between frames. `[timelabels-probe]` and the dump gain `distinct=`, which asserts that no two major labels read the same -- the thing the relative form is for, and the only reading that holds whatever the stream's uptime is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
b505706d92
commit
e2985aa159
4 files changed
+145
-32
No files matched your search
@@ -74,13 +74,28 @@ so the times on the axis do not change when the pause begins. Resuming drops the
|
||||
re-frames on the newest data, so the seconds that passed while paused are *there*, not a hole —
|
||||
which is what pausing used to leave, because it stopped the producer outright.
|
||||
|
||||
**Sub-second windows read relative.** The x ticks are absolute until the window's span goes
|
||||
under a second (with a band to 1.05 s, so the form cannot flicker while a zoom is nudged), and
|
||||
relative below it: the ticks are then generated on a grid anchored at the window's left edge —
|
||||
so they read `0`, `5ms`, `10ms` instead of `12.345671s`, `12.345672s`, which three significant
|
||||
digits cannot even tell apart — and a caption names that anchor in the axes' top-left corner:
|
||||
`t0 = 12.3456 s`. The labels scale through the prefixed units the SI formatter uses — `500ms`,
|
||||
`500us`, `5us`, `5ns` — so a microsecond window reads in microseconds instead of `0.005ms`. Adding the two is the tick's absolute time. The caption is an annotation
|
||||
**The x ticks read relative when, and only when, they could not be written absolutely.** A
|
||||
`TickFormat::Time` label carries three significant digits, so the test is the tick **step**
|
||||
against the label's own **resolution at the axis' magnitude**: `12.345671s` and `12.345672s` are
|
||||
the same string, and there the ticks are re-anchored on a grid at the window's left edge — so
|
||||
they read `0`, `5ms`, `10ms` — with a caption naming that anchor, `t0 = 12.3456 s`. Adding the
|
||||
two is the tick's absolute time. The labels scale through the prefixed units the SI formatter
|
||||
uses — `500ms`, `500us`, `5us`, `5ns` — so a microsecond window reads in microseconds instead of
|
||||
`0.005ms`.
|
||||
|
||||
The rule used to be the *span* alone (relative under a second, with a band to 1.05 s), and a
|
||||
span says nothing about whether a label can be written: it was wrong in **both** directions. A
|
||||
2 s window at twenty minutes of uptime is labelled `20:00` on every tick — `m:ss` carries whole
|
||||
seconds — and was left absolute and unreadable. And a **triggered** sub-second window, whose
|
||||
axis is already `[-25ms, +25ms]` about the edge, reads `-20ms`, `-10ms`, `0`, `10ms` perfectly
|
||||
well, yet was re-anchored anyway: the one position a triggered axis exists to show was displaced
|
||||
by a `t0` caption that had nothing to explain. The step is read back from the majors the last
|
||||
layout produced (a function of the range and the axis width, not of the label form, so no
|
||||
feedback loop), the magnitude is the larger of the two endpoints, and the comparison carries a
|
||||
1.05 band leaving the relative form plus a ULP of slack entering it — a step *equal* to the
|
||||
resolution is readable (`1.73s`, `1.74s`, `1.75s`: one in the last digit is exactly enough), so a
|
||||
decision taken on the last bits of two differently computed doubles picked a different form from
|
||||
one frame to the next. The caption is an annotation
|
||||
inside the axes rather than the axis title on purpose: its text changes with the window, and a
|
||||
title of a changing width would relayout the plot every frame. Everything a user copies out —
|
||||
the cursors' `T0`/`T1`/`dT`, a measurement, an export — stays in absolute stream seconds.
|
||||
|
||||
Reference in new issue
Block a user