Skip to content

Commit f05cd39

Browse files
committed
refactor to avoid adding new instances of the single-arg form of selection.style
1 parent c3649fd commit f05cd39

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/plots/cartesian/axes.js

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

37-
var VISIBLE = { display: null };
38-
var HIDDEN = { display: 'none' };
39-
4037
var ZERO_PATH = { K: 'zeroline' };
4138
var GRID_PATH = { K: 'gridline', L: 'path' };
4239
var TICK_PATH = { K: 'tick', L: 'path' };
@@ -2871,7 +2868,7 @@ axes.drawGrid = function(gd, ax, opts) {
28712868
.attr('d', opts.path)
28722869
.call(Color.stroke, ax.gridcolor || '#ddd')
28732870
.style('stroke-width', ax._gw + 'px')
2874-
.style(VISIBLE);
2871+
.style('display', null); // visible
28752872

28762873
hideCounterAxisInsideTickLabels(ax, [GRID_PATH]);
28772874

@@ -2923,7 +2920,7 @@ axes.drawZeroLine = function(gd, ax, opts) {
29232920
.attr('d', opts.path)
29242921
.call(Color.stroke, ax.zerolinecolor || Color.defaultLine)
29252922
.style('stroke-width', Drawing.crispRound(gd, ax.zerolinewidth, ax._gw || 1) + 'px')
2926-
.style(VISIBLE);
2923+
.style('display', null); // visible
29272924

29282925
hideCounterAxisInsideTickLabels(ax, [ZERO_PATH]);
29292926
};
@@ -3040,7 +3037,7 @@ axes.drawLabels = function(gd, ax, opts) {
30403037
});
30413038

30423039
if(isInside) {
3043-
thisText.style(VISIBLE);
3040+
thisText.style('display', null); // visible
30443041

30453042
if(ax._hideOutOfRangeInsideTickLabels) {
30463043
ax._hideOutOfRangeInsideTickLabels();
@@ -3087,7 +3084,7 @@ axes.drawLabels = function(gd, ax, opts) {
30873084

30883085
var t = thisLabel.select('text');
30893086
if(hide) {
3090-
t.style(HIDDEN);
3087+
t.style('display', 'none'); // hidden
30913088
} else {
30923089
visibleLabelMin = Math.min(visibleLabelMin, isX ? bb.top : bb.left);
30933090
visibleLabelMax = Math.max(visibleLabelMax, isX ? bb.bottom : bb.right);
@@ -3127,9 +3124,9 @@ axes.drawLabels = function(gd, ax, opts) {
31273124

31283125
var t = d3.select(this);
31293126
if(q < ax._visibleLabelMax && q > ax._visibleLabelMin) {
3130-
t.style(HIDDEN);
3127+
t.style('display', 'none'); // hidden
31313128
} else if(e.K === 'tick' && e.L === 'path') {
3132-
t.style(VISIBLE);
3129+
t.style('display', null); // visible
31333130
}
31343131
});
31353132
});

0 commit comments

Comments
 (0)