Repository navigation
Conversation
…previous figure Plots.supplyDefaults copies private keys of the previous figure into the new one. Keys that the defaults step sets only under a condition then stay in the next figure. Set _hasDayOfWeekBreaks on every date axis. Remove _colorAx when a container has no coloraxis. Clear _insideTickLabelsUpdaterange in supplyDefaults. Relink a trace only when the trace type is the same.
This branch has not been deployed
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 #8210. The four cases of the issue no longer keep values of the previous figure after the update.
Cause
Plots.supplyDefaultscopies every private (_) key that the new full trace or layout lacks from the old one (relinkPrivateKeys). A key that the defaults step sets only under a condition thus stays in the next figure.Approach
xaxis._hasDayOfWeekBreaksaxis_defaults.jssets the flag tofalseon every date axiscoloraxisremovedtrace._colorAxcrossTraceDefaultsdeletes the key when the container has nocoloraxis. This step runs after the relink.fullLayout._insideTickLabelsUpdaterangesupplyDefaultsresets the key before the layout relink.Axes.drawsets it again for the axes of the new figure.contourcarpetreplaced_carpetTrace,_a,_band other carpet keyssupplyDefaultsrelinks a trace only when the old and new trace types are the sameCases 1 to 3 keep the trace type or concern layout keys, so they use explicit resets.
constraints.js(_matchGroup) and the map layout defaults (_fitBounds) use the same pattern. For case 4, the check is on the type and not on one pair of types.contourandhistogram2dcontourboth draw throughcontour/plot.js, which reads_carpetTrace.Tests
New jasmine tests:
axes_test.js, "more react tests": case 1 throughPlotly.relayoutandPlotly.react, and case 3colorscale_test.js, "Test colorscale restyle calls": case 2 throughPlotly.reactandPlotly.restyle(gd, {coloraxis: [null]})carpet_test.js, "contourcarpet plotting & editing": case 4 with acontourtrace, with explicit distinct uids, and with ahistogram2dcontourtraceThe
axes,colorscaleandcarpetsuites ran on macOS. With the implementation files ofmain, the 6 new tests fail. With this change, they pass.In the same targeted runs,
axes_test.js"insiderange react to new data" fails with this change and with the implementation files ofmain. The lower bound is-0.181where the test expects-0.173.npm run lintandnpm run typecheckpass. No image baselines move, because image mocks use a freshnewPlot.The contour
zmin/zmaxkey of #8117 is not part of this change (see #8122).Rename
draftlogs/XXXX_fix.mdto the PR number after the PR opens.Screenshots
In each picture, the left chart is the result of the update. The right chart is
Plotly.newPlotof the same figure.Weekend rangebreaks removed with Plotly.relayout: the x tick step (screenshots of the running app):
Before, upstream at 6c18375:
After, this branch:
Shared coloraxis replaced by one colorscale per heatmap with Plotly.react: the color bars and heatmap colors (screenshots of the running app):
Before, upstream at 6c18375:
After, this branch:
Two panels with inside tick labels reduced to one with Plotly.react: the red line is the error the update returned, and the trace width on the x axis (screenshots of the running app):
Before, upstream at 6c18375:
After, this branch:
🐦
Known limitations (follow-ups)
_minDtick) is outside this fix. See Reset forced minimum tick spacing on every calc pass #7950.