fix: correct colorbar editType for map traces (issue #5616 in ploty.py)#7864
Open
yqtian-se wants to merge 2 commits into
Open
fix: correct colorbar editType for map traces (issue #5616 in ploty.py)#7864yqtian-se wants to merge 2 commits into
yqtian-se wants to merge 2 commits into
Conversation
scattermap, scattergeo, and scattermapbox had all colorbar properties with editType='calc' instead of 'colorbars', causing the entire plot to recalculate when colorbar properties changed during initialization. This broke map rendering for scattermap/scattergeo/scattermapbox when marker.colorbar properties (e.g. tickfont.textcase) were set on initial render. Changes: - Added restoreColorbarEditTypes() function to each map trace type - Restores colorbar properties to editType='colorbars' after overrideAll - Regenerated test/plot-schema.json with corrected editTypes Fixes plotly#5616 Closes plotly#5616
Contributor
|
Thanks for the PR! Our team will take a look and follow up with you. |
Contributor
|
@yqtian-se Thanks for the PR! I haven't yet been able to reproduce the linked issue (see my comment here) so I'm not able to test this PR until I can reproduce. If you're able to create a Codepen which demonstrates the issue, that would be super helpful. You can also use the live link to this PR build (https://plotly.github.io/plotly.js-dev-builds/upload/pr-7684/latest/plotly.min.js) to demonstrate this fix. |
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.
Fix colorbar editType for map traces (Issue #5616)
Overview
This PR fixes a bug where setting
marker.colorbarproperties (e.g.,tickfont.textcase='normal') during scattermap/scattergeo/scattermapbox initialization would cause the map to blank on the initial render.Related Issue: Fixes #5616 in plotly.py
Root Cause
The three map trace types (scattermap, scattergeo, scattermapbox) had all
marker.colorbarproperties incorrectly configured witheditType='calc'instead ofeditType='colorbars'.When a property has
editType='calc', it triggers a full plot recalculation. For map traces, this recalculation during initial render was causing the map rendering to fail, leaving only the colorbar visible.In contrast, non-map traces like scatter use
editType='colorbars'for colorbar properties, which only redraws the colorbar without recalculating the entire plot. This is the correct behavior for both map and non-map traces.Solution
restoreColorbarEditTypes()helper function to each map trace type's attributes.jseditType='colorbars'for all colorbar-related properties after theoverrideAll()callFiles Changed
src/traces/scattermap/attributes.jssrc/traces/scattergeo/attributes.jssrc/traces/scattermapbox/attributes.jstest/plot-schema.jsondraftlogs/5616_fix.mdTesting
Backward Compatibility
✓ This is a bug fix with no breaking changes
✓ Existing valid figures continue to work
✓ Previously broken figures (blanking maps) now work correctly
Features, Bug fixes, and others:
Before opening a pull request, developer should:
masterbranch of their fork as usingmasterfor a pull request would make it difficult to fetchupstreamchanges.upstream/masterinto your fork i.e.origin/masterthen pullorigin/masterfrom you localmaster.git rebase mastertheir local dev branch off the latestmasterwhich should be sync withupstream/masterat this time.git addthedist/folder (thedist/is updated only on version bumps).package-lock.jsonfile (if any new dependency required).After opening a pull request, developer:
1010_fix.mdor1010_add.mdinsidedraftlogsfolder as described in this README, commit it and push. A CI check enforces this; PRs that don't warrant a CHANGELOG entry can opt out by applying theno-draftloglabel.git push -f) to remote branches associated with opened pull requests. Force pushes make it hard for maintainers to keep track of updates. Therefore, if required, please fetchupstream/masterand "merge" with master instead of "rebase".