Skip to content

Commit a650170

Browse files
committed
minimal change to add logic to hide funnels
1 parent 4d403fd commit a650170

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/plots/cartesian/layout_defaults.js

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ function appendList(cont, k, item) {
3535

3636
module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
3737
var ax2traces = {};
38-
var xaCheater = {};
39-
var xaNonCheater = {};
38+
var xaHide = {};
39+
var yaHide = {};
40+
var xaDisplay = {};
41+
var yaDisplay = {};
4042
var outerTicks = {};
4143
var noGrids = {};
4244
var i, j;
@@ -66,30 +68,41 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
6668
}
6769
}
6870

71+
// logic for funnels
72+
if(trace.type === 'funnel') {
73+
if(trace.orientation === 'h') {
74+
if(xaName) xaHide[xaName] = true;
75+
} else {
76+
if(yaName) yaHide[yaName] = true;
77+
}
78+
} else {
79+
if(!traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) {
80+
if(xaName) xaDisplay[xaName] = true;
81+
}
82+
if(yaName) yaDisplay[yaName] = true;
83+
}
84+
6985
// Two things trigger axis visibility:
7086
// 1. is not carpet
7187
// 2. carpet that's not cheater
72-
if(!traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) {
73-
if(xaName) xaNonCheater[xaName] = 1;
74-
}
7588

7689
// The above check for definitely-not-cheater is not adequate. This
7790
// second list tracks which axes *could* be a cheater so that the
7891
// full condition triggering hiding is:
7992
// *could* be a cheater and *is not definitely visible*
8093
if(trace.type === 'carpet' && trace._cheater) {
81-
if(xaName) xaCheater[xaName] = 1;
94+
if(xaName) xaHide[xaName] = true;
8295
}
8396

8497
// check for default formatting tweaks
8598
if(traceIs(trace, '2dMap')) {
86-
outerTicks[xaName] = 1;
87-
outerTicks[yaName] = 1;
99+
outerTicks[xaName] = true;
100+
outerTicks[yaName] = true;
88101
}
89102

90103
if(traceIs(trace, 'oriented')) {
91104
var positionAxis = trace.orientation === 'h' ? yaName : xaName;
92-
noGrids[positionAxis] = 1;
105+
noGrids[positionAxis] = true;
93106
}
94107
}
95108

@@ -176,7 +189,9 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
176189
bgColor: bgColor,
177190
calendar: layoutOut.calendar,
178191
automargin: true,
179-
cheateronly: axLetter === 'x' && xaCheater[axName] && !xaNonCheater[axName],
192+
visibleDflt:
193+
(axLetter === 'x' && xaHide[axName] && !xaDisplay[axName]) ||
194+
(axLetter === 'y' && yaHide[axName] && !yaDisplay[axName]),
180195
splomStash: ((layoutOut._splomAxes || {})[axLetter] || {})[id]
181196
};
182197

0 commit comments

Comments
 (0)