Skip to content

Commit 7870720

Browse files
committed
avoid unrecognized messages on click
1 parent 6c0ab2e commit 7870720

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/components/legend/defaults.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
5252

5353
if(!trace.visible) continue;
5454

55+
var isShape = trace._isShape;
56+
5557
// Note that we explicitly count any trace that is either shown or
5658
// *would* be shown by default, toward the two traces you need to
5759
// ensure the legend is shown by default, because this can still help
@@ -69,7 +71,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
6971
legendReallyHasATrace = true;
7072
// Always show the legend by default if there's a pie,
7173
// or if there's only one trace but it's explicitly shown
72-
if(Registry.traceIs(trace, 'pie-like') ||
74+
if(!isShape && Registry.traceIs(trace, 'pie-like') ||
7375
trace._input.showlegend === true
7476
) {
7577
legendTraceCount++;
@@ -79,7 +81,7 @@ function groupDefaults(legendId, layoutIn, layoutOut, fullData) {
7981
Lib.coerceFont(traceCoerce, 'legendgrouptitle.font', grouptitlefont);
8082
}
8183

82-
if((Registry.traceIs(trace, 'bar') && layoutOut.barmode === 'stack') ||
84+
if((!isShape && Registry.traceIs(trace, 'bar') && layoutOut.barmode === 'stack') ||
8385
['tonextx', 'tonexty'].indexOf(trace.fill) !== -1) {
8486
defaultOrder = helpers.isGrouped({traceorder: defaultOrder}) ?
8587
'grouped+reversed' : 'reversed';

src/components/legend/handle_click.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,10 @@ module.exports = function handleClick(g, gd, numClicks) {
125125

126126
var thisLegend = fullTrace.legend;
127127

128-
if(Registry.traceIs(fullTrace, 'pie-like')) {
128+
var fullInput = fullTrace._fullInput;
129+
var isShape = fullInput._isShape;
130+
131+
if(!isShape && Registry.traceIs(fullTrace, 'pie-like')) {
129132
var thisLabel = legendItem.label;
130133
var thisLabelIndex = hiddenSlices.indexOf(thisLabel);
131134

0 commit comments

Comments
 (0)