Skip to content

fix(adapters): aggregate linked members at the range a lock pins - #116

Merged
jvdd merged 3 commits into
mainfrom
fix/linked-lock-viewport
Sep 28, 2026
Merged

jvdd merged 3 commits into
mainfrom
fix/linked-lock-viewport

Conversation

@jvdd

@jvdd jvdd commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the linked case of #82. The unlinked case needs a design and is not in this PR.

Change

  • fvLockAxisGroup (toolbar.js) compares the range each group member shows with the range of the clicked figure. If a member differs, the lock writes the group range as the viewport of the group with fvWriteViewport.
  • Two ranges are equal when each bound differs by less than 1e-9 of the span (fvSameRange). Figures linked on one column rarely show bit-identical ranges: a line shows [3.1e-13, 9999.0000000001] where a histogram shows [0, 9999]. Date strings keep the exact compare.
  • fvOnToggleAxisLocks commits the written keys with fvCommitViewportChange. fvOnLockAllAxes sends one commit for all groups.
  • A group whose members already show one range stays display-only: no viewport write, no request.
  • Architecture.md and docs/guides/cross-filtering.md describe the new behavior. Architecture.md also states that an unlock writes no viewport: a group whose members differed keeps its viewport keys, and a display-only group has none.

Impact

  • Before, a linked member that had autoranged to other data showed the locked window over data that the server had aggregated for its own full range. Measured: A is a line on 0..999, B a line on 0..9999, linked on x, n_points=200. After a lock on A, B showed 20 of its 200 points inside the window. Now all 200 are inside.
  • A lock on a line and a histogram of one column sends no request. With an exact compare, it sent one.
  • After an unlock, the viewport keys stay, so display, state and aggregation keep agreeing. A double-click or reset returns to the full range, as after a zoom.

Known limit

The validator requires equal viewport values in a link group, so when members differ, the clicked figure gets the group viewport too and is re-aggregated at the range it shows. A binned trace then bins on the zoomed lattice. On the weekday hist2d (y 1..7, y_bins=7) the rows go from 7 to 8, with one empty row. A manual zoom to the same range gives the same grid on main. #124 tracks the server fix.

Tests

  • test_lock_aggregates_a_member_at_the_range_it_shows: counts B's points inside its window after a lock on A. Fails before the fix (20 of 200).
  • test_lock_all_sends_one_request_for_every_group: two groups whose members differ give one request with all four keys. Fails before the fix (no request).
  • test_lock_on_members_that_show_one_range_posts_nothing: guards the display-only rule.
  • test_lock_on_a_line_and_histogram_of_one_column_posts_nothing: fails with the exact compare (one request posted).
  • Tree merged with main, pytest tests flexviz_polars/tests: 2425 passed, 2 skipped.
  • Tree merged with main, pytest -m browser tests: 334 passed, 12 skipped.

@codspeed

codspeed Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing fix/linked-lock-viewport (4387721) with main (6213d31)

Open in CodSpeed

@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/linked-lock-viewport branch from 302b047 to 2e494c3 Compare September 27, 2026 22:29
Base automatically changed from fix/log-axis-viewport to main September 28, 2026 11:52
@jvdd
jvdd merged commit a82504e into main Sep 28, 2026
18 checks passed
@jvdd
jvdd deleted the fix/linked-lock-viewport branch September 28, 2026 19:17
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