fix: correct colorbar editType for map traces (issue #5616 in ploty.py) - #7864
fix: correct colorbar editType for map traces (issue #5616 in ploty.py)#7864yqtian-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
|
Thanks for the PR! Our team will take a look and follow up with you. |
|
@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. |
|
@yqtian-se just following up in case you have a chance to create the reproduction @emilykl asked about. Thanks! |
Exact-head verification of the schema-level fix (head
|
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".