Repository navigation
Description
Problem
An axis lock pins the displayed range, but it does not write state.viewport and it does not post. The server then aggregates the figure for a range that is different from the range it shows. The data in the locked window is too coarse, or partly missing.
fvTryLockAxis and fvLockAxisGroup (flexviz/adapters/js/toolbar.js) store the displayed range in client_state.axis_lock_ranges. fvApplyAxisLocks (flexviz/adapters/js/plotly/render.js) only does a Plotly.relayout.
Linked case (new in PR #77)
A lock on a linked axis stores the range of the clicked figure as the lock range of every group member. A member that autoranged to other data then shows that window over data that the server aggregated for its full domain.
Measured in a browser: A is a line on 0..999, B is a line on 0..9999, and both are linked on x with n_points=200. After a lock on A, B shows [0, 996] with 20 of its 200 points in the window. A real zoom to the same range gives B 281 points, all in the window.
On unlock, B keeps the range of A with no viewport key. B goes back to its own range only at its next render.
Unlinked case (older than PR #77)
A figure that autoranges to cross-filtered data and is then locked keeps that range. After a deselect, the server aggregates the figure for its full domain, but the display stays at the old range.
Measured in a browser: A is filtered by a brush on 2000..3000 in update mode and is locked. After a deselect, A shows [2000, 3000] with 20 of its 200 points in the window.
Both cases persist
axis_lock_ranges is saved in the spec, so the state survives Share and restore. syncLayoutViewport applies the lock range again at every render.
Why a lock does not write the viewport today
test_axis_lock_before_zoom_keeps_weekday_heatmap_visible requires that a lock on an autoranged axis writes no viewport and sends no request. A viewport write at the padded autorange of Plotly changes the bins. On the weekday heatmap, the y grid goes from 7 to 8 bins, because a zoomed grid snaps to a lattice.
So "always write the viewport on lock" is not a correct fix.
Fix direction
- Linked case: when a group member shows a range that is different from the clicked figure, write the group range with
fvWriteViewportand commit it withfvCommitViewportChange. Both callers must commit:fvOnToggleAxisLocksandfvOnLockAllAxes(one combined commit). A group whose members already show the same range stays display-only. A browser prototype of this write gave B 280 of 280 points in the window. - Unlinked case: this needs a design. One option is to write the lock range as the viewport only when the displayed range comes from a filtered autorange. Another option is to write it when a later request re-aggregates the locked figure.
- Add browser tests that count the points in the window, not only the displayed range.
test_lock_pins_one_range_on_members_that_autoranged_apartchecks only the displayed ranges and the status.
Activity
jvdd commentedon Sep 29, 2026
Status after #116: