Skip to content

Commit b7855ce

Browse files
committed
use constants for setting visibility
1 parent 8c88f24 commit b7855ce

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/plots/cartesian/axes.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ var ONESEC = constants.ONESEC;
3434
var MINUS_SIGN = constants.MINUS_SIGN;
3535
var BADNUM = constants.BADNUM;
3636

37+
var VISIBLE = { visibility: 'visible' };
38+
var HIDDEN = { visibility: 'hidden' };
39+
3740
var alignmentConstants = require('../../constants/alignment');
3841
var MID_SHIFT = alignmentConstants.MID_SHIFT;
3942
var CAP_SHIFT = alignmentConstants.CAP_SHIFT;
@@ -2865,7 +2868,7 @@ axes.drawGrid = function(gd, ax, opts) {
28652868
.attr('d', opts.path)
28662869
.call(Color.stroke, ax.gridcolor || '#ddd')
28672870
.style('stroke-width', ax._gw + 'px')
2868-
.style({ visibility: 'visible' });
2871+
.style(VISIBLE);
28692872

28702873
if(((ax._anchorAxis || {}).ticklabelposition || '').indexOf('inside') !== -1) {
28712874
if(ax._hideCounterAxisInsideTickLabels) {
@@ -3035,7 +3038,7 @@ axes.drawLabels = function(gd, ax, opts) {
30353038
});
30363039

30373040
if(isInside) {
3038-
thisText.style({ visibility: 'visible' });
3041+
thisText.style(VISIBLE);
30393042

30403043
if(ax._hideOutOfRangeInsideTickLabels) {
30413044
ax._hideOutOfRangeInsideTickLabels();
@@ -3080,7 +3083,7 @@ axes.drawLabels = function(gd, ax, opts) {
30803083
else if(bb.top + (ax.tickangle ? 0 : d.fontSize / 4) < min) hide = true;
30813084
}
30823085
if(hide) {
3083-
thisLabel.select('text').style({ visibility: 'hidden' });
3086+
thisLabel.select('text').style(HIDDEN);
30843087
} else {
30853088
visibleLabelMin = Math.min(visibleLabelMin, isX ? bb.top : bb.left);
30863089
visibleLabelMax = Math.max(visibleLabelMax, isX ? bb.bottom : bb.right);
@@ -3103,7 +3106,7 @@ axes.drawLabels = function(gd, ax, opts) {
31033106
var q = ax.l2p(d.x) + ax._offset;
31043107

31053108
if(q < ax._visibleLabelMax && q > ax._visibleLabelMin) {
3106-
d3.select(this).style({ visibility: 'hidden' });
3109+
d3.select(this).style(HIDDEN);
31073110
}
31083111
});
31093112
});

0 commit comments

Comments
 (0)