Repository navigation
fix: Clear a stale _inputRange when Plotly.react or a whole axis object sets a new range - #8144
Open
Roshan1299 wants to merge 2 commits into
Open
Roshan1299 wants to merge 2 commits into
Roshan1299 wants to merge 2 commits into
Conversation
…ct sets a new range On a constrain:'domain' axis, constraints.enforce compares the range with _inputRange and puts _inputRange back when the range is smaller. Plotly.react and Plotly.relayout with a whole axis object kept the old _inputRange, so a new range drew as the previous one. diffLayout now clears it the way it clears _inputDomain, and the whole axis object case does what the dotted range keys already do.
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.
Fixes #8110.
Plotly.react, andPlotly.relayoutwith a whole axis object, now draw a new range on an axis withconstrain: 'domain', asPlotly.newPlotand the dottedrelayoutkeys do.Why it's right:
constraints.enforcecompares the range with_inputRange, and when the range is smaller it puts_inputRangeback. The dottedrelayoutkeys clear_inputRange.reactand a whole axis object did not, so the previous range came back.diffLayouthandles_inputRangein the loop that handles_inputDomain, as suggested in [BUG]: Plotly.react ignores a new axis range on a scaleanchor + constrain:'domain' axis (stale _inputRange) #8110: it keeps it when the new range equals it or equals the drawn range (the same layout object passed again), and clears it otherwise._relayout, a whole axis object withrangeorautorangerecords the axis as altered and clears_inputRange, like the dotted keys. So the other axes of its constraint group can rescale too.Tests: five cases in
axes_test.js(constraints relayout), with the layout from the issue. Withplot_api.jsatmain, three fail (react, a whole axis object with both ranges, a whole axis object with one range); the dotted single-range case and "same layout again" pass on both, as controls.Suites run locally (Chrome 155, macOS):
axes406 of 407,plot_api_react113,plot_api171,cartesian20,cartesian_interact75 of 76. The two failures (insiderange react to new data, multicategory tick label span during drag) fail the same way withplot_api.jsatmain.The "same layout again" branch (a range that equals the drawn range but not
_inputRange) has no test of its own; it mirrors the_inputDomainbranch above it.I didn't run the image tests: the change only touches
reactandrelayout, and no mock was added or changed.