Skip to content

Commit f07ff4b

Browse files
committed
set visible:false if showupper & showlower & diagonal.visible are false
1 parent d4a2a53 commit f07ff4b

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

src/traces/splom/defaults.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2121
}
2222

2323
var dimLength = handleDimensionsDefaults(traceIn, traceOut);
24-
if(!dimLength) {
24+
25+
var showDiag = coerce('diagonal.visible');
26+
var showUpper = coerce('showupperhalf');
27+
var showLower = coerce('showlowerhalf');
28+
29+
if(!dimLength || (!showDiag && !showUpper && !showLower)) {
2530
traceOut.visible = false;
2631
return;
2732
}
@@ -34,13 +39,6 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3439
var isBubble = subTypes.isBubble(traceOut);
3540
coerce('marker.line.width', isOpen || isBubble ? 1 : 0);
3641

37-
// TODO if all 3 below are false,
38-
// should we set `visible: false` and exit early?
39-
40-
coerce('diagonal.visible');
41-
coerce('showupperhalf');
42-
coerce('showlowerhalf');
43-
4442
handleAxisDefaults(traceIn, traceOut, layout, coerce);
4543

4644
Lib.coerceSelectionMarkerOpacity(traceOut, coerce);

test/jasmine/tests/splom_test.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,27 @@ describe('Test splom trace defaults:', function() {
2424
supplyAllDefaults(gd);
2525
}
2626

27-
it('should set to `visible: false` dimensions-less traces', function() {
27+
it('should set `visible: false` dimensions-less traces', function() {
2828
_supply([{}, {dimensions: []}]);
2929

3030
expect(gd._fullData[0].visible).toBe(false);
3131
expect(gd._fullData[1].visible).toBe(false);
3232
});
3333

34-
it('should set to `visible: false` to values-less dimensions', function() {
34+
it('should set `visible: false` to traces with showupperhalf, showlowerhalf, and diagonal.visible false', function() {
35+
_supply({
36+
dimensions: [{
37+
values: [1, 2, 3]
38+
}],
39+
showupperhalf: false,
40+
showlowerhalf: false,
41+
diagonal: {visible: false}
42+
});
43+
44+
expect(gd._fullData[0].visible).toBe(false);
45+
});
46+
47+
it('should set `visible: false` to values-less dimensions', function() {
3548
_supply({
3649
dimensions: [
3750
'not-an-object',

0 commit comments

Comments
 (0)