Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions draftlogs/5616_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Fix colorbar editType for map traces

### Bug
Setting `marker.colorbar` properties (e.g., `tickfont.textcase='normal'`) during scattermap/scattergeo/scattermapbox initialization would cause the map to blank on initial render.

### Root Cause
Map traces had `marker.colorbar` properties with `editType='calc'` instead of `editType='colorbars'`. This caused the entire plot to recalculate on colorbar property changes, breaking map rendering during initialization.

### Fix
- Added `restoreColorbarEditTypes()` function to restore correct editType for all colorbar properties
- Applied to scattermap, scattergeo, and scattermapbox trace types
- Regenerated test/plot-schema.json with corrected editTypes

### Impact
- Fixes #5616: Scattermap no longer blanks when colorbar properties are set on initial render
- Brings map trace behavior in line with non-map traces like scatter
- No breaking changes, full backward compatibility
36 changes: 34 additions & 2 deletions src/traces/scattergeo/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,39 @@ const breakingChangeWarning = [
'Country names in existing plots may not work in the new version.'
].join(' ');

module.exports = overrideAll(
function restoreColorbarEditTypes(attrs) {
function restoreEditTypes(obj) {
for(var key in obj) {
var val = obj[key];
if(val && typeof val === 'object') {
if(val.editType === 'calc') {
val.editType = 'colorbars';
}
if(!val.valType) {
restoreEditTypes(val);
}
if(Array.isArray(val.items)) {
for(var i = 0; i < val.items.length; i++) {
if(val.items[i] && typeof val.items[i] === 'object') {
if(val.items[i].editType === 'calc') {
val.items[i].editType = 'colorbars';
}
if(!val.items[i].valType) {
restoreEditTypes(val.items[i]);
}
}
}
}
}
}
}
if(attrs && attrs.marker && attrs.marker.colorbar) {
restoreEditTypes(attrs.marker.colorbar);
}
return attrs;
}

module.exports = restoreColorbarEditTypes(overrideAll(
{
lon: {
valType: 'data_array',
Expand Down Expand Up @@ -175,4 +207,4 @@ module.exports = overrideAll(
},
'calc',
'nested'
);
));
36 changes: 34 additions & 2 deletions src/traces/scattermap/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,39 @@ var mapLayoutAtributes = require('../../plots/map/layout_attributes');
var lineAttrs = scatterGeoAttrs.line;
var markerAttrs = scatterGeoAttrs.marker;

module.exports = overrideAll(
function restoreColorbarEditTypes(attrs) {
function restoreEditTypes(obj) {
for(var key in obj) {
var val = obj[key];
if(val && typeof val === 'object') {
if(val.editType === 'calc') {
val.editType = 'colorbars';
}
if(!val.valType) {
restoreEditTypes(val);
}
if(Array.isArray(val.items)) {
for(var i = 0; i < val.items.length; i++) {
if(val.items[i] && typeof val.items[i] === 'object') {
if(val.items[i].editType === 'calc') {
val.items[i].editType = 'colorbars';
}
if(!val.items[i].valType) {
restoreEditTypes(val.items[i]);
}
}
}
}
}
}
}
if(attrs && attrs.marker && attrs.marker.colorbar) {
restoreEditTypes(attrs.marker.colorbar);
}
return attrs;
}

module.exports = restoreColorbarEditTypes(overrideAll(
{
lon: scatterGeoAttrs.lon,
lat: scatterGeoAttrs.lat,
Expand Down Expand Up @@ -177,4 +209,4 @@ module.exports = overrideAll(
},
'calc',
'nested'
);
));
36 changes: 34 additions & 2 deletions src/traces/scattermapbox/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,39 @@ var mapboxLayoutAtributes = require('../../plots/mapbox/layout_attributes');
var lineAttrs = scatterGeoAttrs.line;
var markerAttrs = scatterGeoAttrs.marker;

module.exports = overrideAll(
function restoreColorbarEditTypes(attrs) {
function restoreEditTypes(obj) {
for(var key in obj) {
var val = obj[key];
if(val && typeof val === 'object') {
if(val.editType === 'calc') {
val.editType = 'colorbars';
}
if(!val.valType) {
restoreEditTypes(val);
}
if(Array.isArray(val.items)) {
for(var i = 0; i < val.items.length; i++) {
if(val.items[i] && typeof val.items[i] === 'object') {
if(val.items[i].editType === 'calc') {
val.items[i].editType = 'colorbars';
}
if(!val.items[i].valType) {
restoreEditTypes(val.items[i]);
}
}
}
}
}
}
}
if(attrs && attrs.marker && attrs.marker.colorbar) {
restoreEditTypes(attrs.marker.colorbar);
}
return attrs;
}

module.exports = restoreColorbarEditTypes(overrideAll(
{
lon: scatterGeoAttrs.lon,
lat: scatterGeoAttrs.lat,
Expand Down Expand Up @@ -177,4 +209,4 @@ module.exports = overrideAll(
},
'calc',
'nested'
);
));
Loading
Loading