Skip to content

Commit 9a18062

Browse files
committed
perf xaCheater/xaNonCheater test in cartesian axes defaults
1 parent 687a2e2 commit 9a18062

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/plots/cartesian/layout_defaults.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
2929
yaListCartesian = [],
3030
xaListGl2d = [],
3131
yaListGl2d = [],
32-
xaListCheater = [],
33-
xaListNonCheater = [],
32+
xaCheater = {},
33+
xaNonCheater = {},
3434
outerTicks = {},
3535
noGrids = {},
3636
i;
@@ -57,15 +57,15 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
5757
// 1. is not carpet
5858
// 2. carpet that's not cheater
5959
if(!Registry.traceIs(trace, 'carpet') || (trace.type === 'carpet' && !trace._cheater)) {
60-
if(xaName) Lib.pushUnique(xaListNonCheater, xaName);
60+
if(xaName) xaNonCheater[xaName] = 1;
6161
}
6262

6363
// The above check for definitely-not-cheater is not adequate. This
6464
// second list tracks which axes *could* be a cheater so that the
6565
// full condition triggering hiding is:
6666
// *could* be a cheater and *is not definitely visible*
6767
if(trace.type === 'carpet' && trace._cheater) {
68-
if(xaName) Lib.pushUnique(xaListCheater, xaName);
68+
if(xaName) xaCheater[xaName] = 1;
6969
}
7070

7171
// add axes implied by traces
@@ -186,7 +186,7 @@ module.exports = function supplyLayoutDefaults(layoutIn, layoutOut, fullData) {
186186
data: fullData,
187187
bgColor: bgColor,
188188
calendar: layoutOut.calendar,
189-
cheateronly: axLetter === 'x' && (xaListCheater.indexOf(axName) !== -1 && xaListNonCheater.indexOf(axName) === -1)
189+
cheateronly: axLetter === 'x' && (xaCheater[axName] && !xaNonCheater[axName])
190190
};
191191

192192
handleAxisDefaults(axLayoutIn, axLayoutOut, coerce, defaultOptions, layoutOut);

0 commit comments

Comments
 (0)