Skip to content

Commit 9c76d7a

Browse files
committed
exit early in axis defaults when visible is false
- no need to coerce attribute that don't have an effect
1 parent bc1c5c8 commit 9c76d7a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/plots/cartesian/axis_defaults.js

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
4747
return Lib.coerce2(containerIn, containerOut, layoutAttributes, attr, dflt);
4848
}
4949

50-
coerce('visible', !options.cheateronly);
50+
var visible = coerce('visible', !options.cheateronly);
5151

5252
var axType = containerOut.type;
5353

@@ -58,6 +58,20 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
5858

5959
setConvert(containerOut, layoutOut);
6060

61+
var autoRange = coerce('autorange', !containerOut.isValidRange(containerIn.range));
62+
63+
if(autoRange) coerce('rangemode');
64+
65+
coerce('range');
66+
containerOut.cleanRange();
67+
68+
handleCategoryOrderDefaults(containerIn, containerOut, coerce);
69+
containerOut._initialCategories = axType === 'category' ?
70+
orderedCategories(letter, containerOut.categoryorder, containerOut.categoryarray, options.data) :
71+
[];
72+
73+
if(!visible) return containerOut;
74+
6175
var dfltColor = coerce('color');
6276
// if axis.color was provided, use it for fonts too; otherwise,
6377
// inherit from global font color in case that was provided.
@@ -70,17 +84,9 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
7084
color: dfltFontColor
7185
});
7286

73-
var autoRange = coerce('autorange', !containerOut.isValidRange(containerIn.range));
74-
75-
if(autoRange) coerce('rangemode');
76-
77-
coerce('range');
78-
containerOut.cleanRange();
79-
8087
handleTickValueDefaults(containerIn, containerOut, coerce, axType);
8188
handleTickLabelDefaults(containerIn, containerOut, coerce, axType, options);
8289
handleTickMarkDefaults(containerIn, containerOut, coerce, options);
83-
handleCategoryOrderDefaults(containerIn, containerOut, coerce);
8490

8591
var lineColor = coerce2('linecolor', dfltColor),
8692
lineWidth = coerce2('linewidth'),
@@ -111,10 +117,5 @@ module.exports = function handleAxisDefaults(containerIn, containerOut, coerce,
111117
delete containerOut.zerolinewidth;
112118
}
113119

114-
// fill in categories
115-
containerOut._initialCategories = axType === 'category' ?
116-
orderedCategories(letter, containerOut.categoryorder, containerOut.categoryarray, options.data) :
117-
[];
118-
119120
return containerOut;
120121
};

0 commit comments

Comments
 (0)