fix(adapters): draw linked hover and the edit-drag preview in data units on a log axis - #118
Merged
Merged
Conversation
jvdd
force-pushed
the
fix/log-axis-viewport
branch
from
September 27, 2026 22:29
6abd79c to
22adf68
Compare
jvdd
force-pushed
the
fix/log-axis-hover-and-edit-brush
branch
from
September 27, 2026 22:29
6bc9e5e to
85ba934
Compare
jvdd
force-pushed
the
fix/log-axis-hover-and-edit-brush
branch
from
September 28, 2026 19:53
85ba934 to
9d9a618
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three log-axis bugs found in the review of #113. They sit on the same boundary: Plotly holds log axis positions in log10 units, while FlexViz values are data units. The third also affects linear axes.
Change
plotly/hover.js): guides, bands and rects passed data values tol2p, which expects log10 on a log axis. They now usec2p. In plotly.js 4.1.1c2pisl2pon every axis except log, where it takes log10 first, so linear, date and category axes keep their old behavior. (d2pwas rejected: on a date axis it parses an epoch-ms number throughnew Date()and shifts it by the browser's timezone offset.)plotly/hover.js,axisSpanToPixels): bands and cell outlines are clipped to the plot area. A zoomed grid snaps outward, so its first bin starts left of the plot. On a log axis the lattice puts that edge at 0 whenever the zoom starts below one bin width, andc2p(0)has no position.c2p(v, true)maps it past the axis start, and the clip keeps the band inside the plot. Guide lines keepc2p(v): a guide at or below 0 on a log axis is not drawn.plotly/events.js):_fvOutlineDataRangeusedp2r, which is log10 on a log axis. It now usesp2don a log axis only, as Plotly's ownmakeFillRangeItemsdoes. Date and category axes are unchanged.Architecture.md: the "Log axes" bullet describes the three fixes.TestLinkedHoverBrowser. The two edit-drag live brush tests are one test, parametrized on linear and log.Impact
bins=50, the first bin is[0, 9.98]and covers 29 % of the plot width. Before this PR the band was drawn at a wrong position; withc2palone it was not drawn.Related: #127 (a histogram with a bin edge at 0 on a log x axis autoranges over 16 decades).
Tests
TestLogAxisBrowser::test_linked_hover_guide_lands_at_the_data_value_on_a_log_target: the expected pixel is computed independently (l2p(log10(x))). Fails before the fix.TestLinkedHoverBrowser::test_temporal_hover_band_lands_on_the_bin_edge_off_utc(browser time zone Europe/Brussels): guards the date axis. It fails with ad2pversion of the fix.TestLinkedHoverBrowser::test_hover_band_is_clipped_to_the_plot_area[linear|log]: the band starts at the plot edge and ends at the bin edge. Fails before the fix (linear: band at 56.16 px, plot at 60 px; log: no band).test_browser_cube.py::TestLiveBrushCube::test_edit_existing_box_live_brush[linear|log]: the live preview equals the committed result at the same mouse position. The log case fails before the fix.main,pytest tests flexviz_polars/tests: 2425 passed, 2 skipped.main,pytest -m browser tests: 339 passed, 15 skipped.