Skip to content

Commit cd246e9

Browse files
committed
Move legendonly restriction to supplyTraceDefaults
1 parent 688516a commit cd246e9

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/components/legend/draw.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,9 @@ function handleClick(g, gd, numClicks) {
510510

511511
for(i = 0; i < fullData.length; i++) {
512512
allTraces.push(i);
513-
// For carpet traces in particular, push the current visibility. For others, legendonly:
514-
traceVisibility.push(Registry.traceIs(fullData[i], 'notLegendIsolatable') ? fullData[i].visible : 'legendonly');
513+
// Allow the legendonly state through for *all* trace types (including
514+
// carpet for which it's overridden with true/false in supplyDefaults)
515+
traceVisibility.push('legendonly');
515516
}
516517

517518
if(legendgroup === '') {

src/plots/plots.js

+6
Original file line numberDiff line numberDiff line change
@@ -860,6 +860,12 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
860860
coerce('legendgroup');
861861
}
862862

863+
if(plots.traceIs(traceOut, 'notLegendIsolatable')) {
864+
// This clears out the legendonly state for traces like carpet that
865+
// cannot be isolated in the legend
866+
traceOut.visible = !!traceOut.visible;
867+
}
868+
863869
plots.supplyTransformDefaults(traceIn, traceOut, layout);
864870
}
865871

0 commit comments

Comments
 (0)