Skip to content

fix(signal): keep the X axis aligned with the grid after a refresh - #458

Merged
PierreRaybaut merged 2 commits into
developfrom
fix/457-xaxis-grid-alignment
Oct 29, 2026
Merged

PierreRaybaut merged 2 commits into
developfrom
fix/457-xaxis-grid-alignment

Conversation

@PierreRaybaut

Copy link
Copy Markdown
Contributor

Fixes #457.

Problem

After opening a signal or changing the selection, the X axis ticks could be shifted relative to the vertical grid lines and the curves, until the view was panned or zoomed. This happened with signals whose X axis does not start and end on a graduation, e.g. step.npy from the Sigima test data (axis drawn between 7 and 503 px, grid and curve between -1 and 509 px).

Root cause

Changes

  • refresh_plot: restore the default scale draw only when leaving the date/time mode (current scale draw is a QwtDateTimeScaleDraw), so that regular refreshes keep the X axis scale draw.
  • New datalab/tests/features/signal/xaxis_scale_draw_unit_test.py: X scale draw kept on refresh, X axis aligned with the canvas map, date/time formatting still removed when showing regular signals.
  • Docs: 1.4.0 release note (EN/FR).

With this change, regular signals are fixed whatever the PythonQwt version. The date/time mode still creates a new scale draw on each refresh, which is fixed by the PythonQwt change.

Tests

After opening a signal or changing the selection, the X axis ticks could
be shifted relative to the vertical grid lines and the curves, until the
view was panned or zoomed, for signals whose X axis does not start and
end on a graduation (e.g. step.npy from the Sigima test data).

SignalPlotHandler.refresh_plot replaced the bottom scale draw with a new
QwtScaleDraw on every refresh, to undo the date/time formatting, even
when the X axis was not in date/time mode. PythonQwt laid the new scale
draw out before giving it the geometry of the previous one, with border
distances differing from those used to draw the grid and the curves
(PlotPyStack/PythonQwt#113, fixed by PlotPyStack/PythonQwt#114).

- refresh_plot: restore the default scale draw only when leaving the
  date/time mode, i.e. when the current one is a QwtDateTimeScaleDraw.
- Regression tests: X scale draw kept on refresh, X axis aligned with
  the canvas map, date/time formatting still removed for regular signals.

Closes #457

Assisted-by: Claude Opus 5.5
Add the 1.4.0 bug-fix note on the X axis ticks shifted relative to the
grid and the curves, and its French translation.

Refs #457

Assisted-by: Claude Opus 5.5
@PierreRaybaut
PierreRaybaut merged commit ca8fdea into develop Oct 29, 2026
6 checks passed
@PierreRaybaut
PierreRaybaut deleted the fix/457-xaxis-grid-alignment branch October 29, 2026 13:54
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