Skip to content

Commit f3095bf

Browse files
committed
add no legend to layout when legend does not show up
1 parent c62e632 commit f3095bf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Diff for: src/components/fx/hoverlabel_defaults.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ var isUnifiedHover = require('./helpers').isUnifiedHover;
77
module.exports = function handleHoverLabelDefaults(contIn, contOut, coerce, opts) {
88
opts = opts || {};
99

10-
var hasLegend =
11-
contOut.legend &&
12-
contOut.legend.font;
10+
var hasLegend = contOut.legend;
1311

1412
function inheritFontAttr(attr) {
1513
if(!opts.font[attr]) {

Diff for: src/components/legend/defaults.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
1919
}
2020

2121
var trace;
22-
23-
function traceCoerce(attr, dflt) {
22+
var traceCoerce = function(attr, dflt) {
2423
var traceIn = trace._input;
2524
var traceOut = trace;
2625
return Lib.coerce(traceIn, traceOut, plotsAttrs, attr, dflt);
27-
}
26+
};
2827

2928
var globalFont = layoutOut.font || {};
3029
var grouptitlefont = Lib.coerceFont(coerce, 'grouptitlefont', Lib.extendFlat({}, globalFont, {
@@ -83,6 +82,9 @@ module.exports = function legendDefaults(layoutIn, layoutOut, fullData) {
8382
basePlotLayoutAttributes, 'showlegend',
8483
legendReallyHasATrace && legendTraceCount > 1);
8584

85+
// delete legend
86+
if(showLegend === false) layoutOut.legend = undefined;
87+
8688
if(showLegend === false && !containerIn.uirevision) return;
8789

8890
coerce('uirevision', layoutOut.uirevision);

0 commit comments

Comments
 (0)