Skip to content

fix: keep reversed axes reversed and sort reversed cube viewports - #117

Merged
jvdd merged 6 commits into
mainfrom
fix/axis-handling-gaps
Sep 28, 2026
Merged

jvdd merged 6 commits into
mainfrom
fix/axis-handling-gaps

Conversation

@jvdd

@jvdd jvdd commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes items 1 and 4 of #81. Item 3 was already fixed on main by d370e8f (test TestAgentReadback::test_apply_updates_the_lock_controls). Item 2 is covered by #110. Item 5 needs a design and is not in this PR.

Change

  • Item 1. syncLayoutViewport set autorange: true on every axis without a viewport key, so a reversed axis rendered normal. A new declaredAutorange reads the figure layout from the spec (Plotly writes autorange: true back into the layout it draws) and follows the rule of _axis_reversed in spec.py: any autorange that contains "reversed", or a fixed range given high to low, gives "reversed". The fixed bounds are still dropped, as before. So "min reversed" and "max reversed" also give "reversed": without their fixed end, Plotly draws them at a default range.
  • Direction of a stored range. A new orientedRange orders every range the client writes to Plotly (syncLayoutViewport and fvApplyAxisLocks) by the declared direction. A stored viewport or lock range holds only its bounds, so one given low to high, for example through flexvizApply, still draws a reversed axis reversed.
  • Item 4. FlexEngine.build_cubes now normalizes reversed viewport pairs, like FlexEngine.process. Both call one helper, _normalize_viewports, first.
  • The client cube key (_fvCubeViewportDomain) sorts the pair too. Without this, the key of a reversed source never matched the sorted server header.
  • Separate commit: fvApplyAxisLocks loses its unused changedAxisId parameter and branch. No caller passed it, and the branch wrote autorange: true.
  • Architecture.md describes reversed axes and the ingestion step.

Impact

  • fig.update_layout(xaxis={"autorange": "reversed"}) (or "min reversed", "max reversed", or a fixed range given high to low) renders reversed on the first render, and stays reversed after a zoom, a panel reset, a double-click autorange, a global reset and an axis lock.
  • A viewport or lock range given low to high on a reversed axis draws the axis reversed. A range given high to low on a normal axis now draws it normal.
  • A live brush on a zoomed, reversed, cacheable source now filters the target. Before, the server built a range filter with lo > hi, so the preview and the commit showed no rows, and with only the server fix the client would refuse every cube for that source.
  • The same view gives the same server cube key for both viewport orders.

Tests

  • TestReversedAxisBrowser::test_reversed_axis_survives_zoom_and_reset, for autorange: "reversed", for range: [999, 0], and for "min reversed" and "max reversed" with a fixed end. The first two fail before the item 1 commit, the last two before the commit that makes them "reversed".
  • TestReversedAxisBrowser::test_range_given_low_to_high_draws_reversed, for a viewport and for a lock range set through flexvizApply. Both fail before the orientedRange commit.
  • test_cube_server.py::test_reversed_viewports_resolve_like_ascending_ones: the cube header for reversed viewports equals the header for ascending ones. Fails before the fix.
  • test_browser_cube.py::test_reversed_zoomed_source_live_updates: a live brush on a reversed, zoomed source sends one cube request and filters the target to some of its rows. Fails before the fix (the target sums to 0).
  • On this branch merged with main: pytest tests: 2290 passed, 1 skipped. pytest -m browser tests: 330 passed, 12 skipped.

@jvdd
jvdd force-pushed the fix/log-axis-viewport branch from 6abd79c to 22adf68 Compare September 27, 2026 22:29
@jvdd
jvdd force-pushed the fix/axis-handling-gaps branch from 00330a7 to 0d35a63 Compare September 27, 2026 22:29
@codspeed

codspeed Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing fix/axis-handling-gaps (087ade9) with main (a64c949)

Open in CodSpeed

Base automatically changed from fix/log-axis-viewport to main September 28, 2026 11:52
@jvdd
jvdd merged commit 6213d31 into main Sep 28, 2026
18 checks passed
@jvdd
jvdd deleted the fix/axis-handling-gaps branch September 28, 2026 16:47
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