Skip to content

Commit d501bb0

Browse files
committed
prune 'customdata' and 'ids' if undefined at trace-level attribute
1 parent b7679a6 commit d501bb0

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

src/plots/plots.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,7 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
11251125
// we want even invisible traces to make their would-be subplots visible
11261126
// so coerce the subplot id(s) now no matter what
11271127
var _module = plots.getModule(traceOut);
1128+
11281129
traceOut._module = _module;
11291130
if(_module) {
11301131
var basePlotModule = _module.basePlotModule;
@@ -1158,9 +1159,21 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
11581159
}
11591160
}
11601161

1162+
function coerceUnlessPruned(attr, dflt, cb) {
1163+
if(_module && (attr in _module.attributes) && _module.attributes[attr] === undefined) {
1164+
// Pruned
1165+
} else {
1166+
if(cb && typeof cb === 'function') {
1167+
cb();
1168+
} else {
1169+
coerce(attr, dflt);
1170+
}
1171+
}
1172+
}
1173+
11611174
if(visible) {
1162-
coerce('customdata');
1163-
coerce('ids');
1175+
coerceUnlessPruned('customdata');
1176+
coerceUnlessPruned('ids');
11641177

11651178
if(Registry.traceIs(traceOut, 'showLegend')) {
11661179
traceOut._dfltShowLegend = true;
@@ -1171,14 +1184,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOut, colorIndex, layout, trac
11711184
traceOut._dfltShowLegend = false;
11721185
}
11731186

1174-
if(_module && ('hoverlabel' in _module.attributes) && _module.attributes.hoverlabel === undefined) {
1175-
// Do not coerce hoverlabel
1176-
} else {
1187+
coerceUnlessPruned('hoverlabel','',function() {
11771188
Registry.getComponentMethod(
11781189
'fx',
11791190
'supplyDefaults'
11801191
)(traceIn, traceOut, defaultColor, layout);
1181-
}
1192+
});
11821193

11831194
// TODO add per-base-plot-module trace defaults step
11841195

0 commit comments

Comments
 (0)