@@ -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' ;
0 commit comments