fix: the t0 caption is chrome anchored to the axis, not an annotation in the data

The caption that names the relative x labels' anchor was an `Annotation`, whose anchor
is a data coordinate -- so it crawled across the plot under a pan and drifted under a
zoom, which is how it was reported. It is now `Plot::set_x_note()`: the bottom row's
caption, drawn by the renderer in the axes' bottom-left corner in pixels, on the
legend's own backplate.

The text stays the host's, because only the host knows that label + caption has to be
the exact absolute time (`%.6g`, where `format_time()` would round to three figures).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Opus 4.6 committed 2026-10-05 18:21:28 +02:00
1 parent e2985aa159
commit 39f30d913f
6 files changed
+47 -45

No files matched your search

+5 -10
View File
@@ -7264,10 +7264,7 @@ gboolean timelabels_probe_step(gpointer user) {
ticks += t.label;
}
}
if (last.time_origin_note < last.plot->annotation_count()) {
const plot::Annotation& an = last.plot->annotation(last.time_origin_note);
if (an.visible) note = an.text;
}
note = last.plot->x_note();
}
double first_value = 0.0;
plot::Range shown{};
@@ -8317,14 +8314,12 @@ int run_ui(int argc, char** argv, const Config& cfg, ScopeModel& model, Acquisit
}
{
// The x label form: relative to the window's own start (with the caption that names
// that start) while the span is sub-second, absolute otherwise. `x_origin_set` is read
// back out of the plot, so this is what the axis is actually formatting with.
// that start) when the labels could not carry the tick step absolutely, absolute
// otherwise. `x_origin_set` is read back out of the plot, so this is what the axis is
// actually formatting with, and `note` is the plot's own caption string.
const RowSet::Row& rlt = rows.row(rows.row_count() - 1);
std::string note;
if (rlt.plot != nullptr && rlt.time_origin_note < rlt.plot->annotation_count()) {
const plot::Annotation& a = rlt.plot->annotation(rlt.time_origin_note);
if (a.visible) note = a.text;
}
if (rlt.plot != nullptr) note = rlt.plot->x_note();
// The labels themselves, from the axis the reader looks at: the assertion is what the
// ticks *say*, not only which mode is on.
std::string ticks;