Skip to content

Commit e683b07

Browse files
committed
interactively hide tick labels
1 parent caf3239 commit e683b07

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/plots/cartesian/axes.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,10 @@ axes.drawLabels = function(gd, ax, opts) {
29982998
// sync label: just position it now.
29992999
positionLabels(thisLabel, tickAngle);
30003000
}
3001-
});
3001+
})
3002+
.style('display', null); // visible
3003+
3004+
hideCounterAxisInsideTickLabels(ax, [TICK_TEXT]);
30023005

30033006
tickLabels.exit().remove();
30043007

@@ -3040,7 +3043,7 @@ axes.drawLabels = function(gd, ax, opts) {
30403043
});
30413044

30423045
if(isInside) {
3043-
thisText.style('display', null); // visible
3046+
thisText.style('opacity', 0); // visible
30443047

30453048
if(ax._hideOutOfRangeInsideTickLabels) {
30463049
ax._hideOutOfRangeInsideTickLabels();
@@ -3088,8 +3091,10 @@ axes.drawLabels = function(gd, ax, opts) {
30883091

30893092
var t = thisLabel.select('text');
30903093
if(hide) {
3091-
t.style('display', 'none'); // hidden
3094+
t.style('opacity', 0); // hidden
30923095
} else {
3096+
t.style('opacity', 1); // visible
3097+
30933098
if(side === 'bottom' || side === 'right') {
30943099
visibleLabelMin = Math.min(visibleLabelMin, isX ? bb.top : bb.left);
30953100
} else {
@@ -3138,7 +3143,7 @@ axes.drawLabels = function(gd, ax, opts) {
31383143
var t = d3.select(this);
31393144
if(q < ax._visibleLabelMax && q > ax._visibleLabelMin) {
31403145
t.style('display', 'none'); // hidden
3141-
} else if(e.K === 'tick' && e.L === 'path') {
3146+
} else if(e.K === 'tick') {
31423147
t.style('display', null); // visible
31433148
}
31443149
});
-1.52 KB
Loading
377 Bytes
Loading
3.58 KB
Loading

0 commit comments

Comments
 (0)