Skip to content

Commit 30b0280

Browse files
committed
Fix contourcarpet showlegend
1 parent 19a960b commit 30b0280

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/plots/plots.js

-6
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,6 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
837837
// gets overwritten in pie, geo and ternary modules
838838
coerce('hoverinfo', (layout._dataLength === 1) ? 'x+y+z+text' : undefined);
839839

840-
// gets overwritten by carpetcontour
841840
if(plots.traceIs(traceOut, 'showLegend')) {
842841
coerce('showlegend');
843842
coerce('legendgroup');
@@ -855,11 +854,6 @@ plots.supplyTraceDefaults = function(traceIn, traceOutIndex, layout, traceInInde
855854
coerceSubplotAttr('gl2d', 'xaxis');
856855
coerceSubplotAttr('gl2d', 'yaxis');
857856

858-
if(plots.traceIs(traceOut, 'showLegend')) {
859-
coerce('showlegend');
860-
coerce('legendgroup');
861-
}
862-
863857
if(plots.traceIs(traceOut, 'notLegendIsolatable')) {
864858
// This clears out the legendonly state for traces like carpet that
865859
// cannot be isolated in the legend

src/traces/contourcarpet/defaults.js

-3
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,13 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
7777
// after the initial draw, we can just reuse the previous calculation
7878
contourSize = coerce('contours.size');
7979
coerce('contours.coloring');
80-
81-
traceOut.showlegend = false;
8280
}
8381

8482
// Override the trace-level showlegend default with a default that takes
8583
// into account whether this is a constraint or level contours:
8684
Lib.coerce(traceIn, traceOut, plotAttributes, 'showlegend', traceOut.contours.type === 'constraint');
8785

8886
missingEnd = (contourStart === false) || (contourEnd === false);
89-
autoContour;
9087

9188
if(missingEnd) {
9289
autoContour = traceOut.autocontour = true;

test/image/mocks/cheater_contour.json

+8-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
"width":2,
3636
"smoothing":0
3737
},
38-
"colorscale":"Viridis",
38+
"colorbar": {
39+
"len": 0.4,
40+
"y": 0.25
41+
},
3942
"z":[1, 1.96, 2.56, 3.0625, 4, 5.0625, 1, 7.5625, 9, 12.25, 15.21, 14.0625],
4043
"a":[0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
4144
"b":[4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6],
@@ -76,7 +79,10 @@
7679
"line":{
7780
"width":2
7881
},
79-
"colorscale":"Viridis",
82+
"colorbar": {
83+
"len": 0.4,
84+
"y": 0.75
85+
},
8086
"z":[1, 1.96, 2.56, 3.0625, 4, 5.0625, 1, 7.5625, 9, 12.25, 15.21, 14.0625],
8187
"a":[0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3],
8288
"b":[4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6],

0 commit comments

Comments
 (0)