Skip to content

Commit 8efa7bd

Browse files
committed
adjust vertical ticklabels on x axes
1 parent a7518ec commit 8efa7bd

File tree

6 files changed

+11
-2
lines changed

6 files changed

+11
-2
lines changed

src/plots/cartesian/axes.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -2641,7 +2641,7 @@ axes.makeLabelFns = function(ax, shift, angle) {
26412641

26422642
var side = ax.side;
26432643
var axLetter = ax._id.charAt(0);
2644-
2644+
var tickangle = ax.tickangle;
26452645
var endSide;
26462646
if(axLetter === 'x') {
26472647
endSide =
@@ -2654,6 +2654,16 @@ axes.makeLabelFns = function(ax, shift, angle) {
26542654
x0 = labelShift * flipIt;
26552655
y0 = shift + labelStandoff * flipIt;
26562656
ff = endSide ? 1 : -0.2;
2657+
if(Math.abs(tickangle) === 90) {
2658+
if(
2659+
(tickangle === -90 && side === 'bottom') ||
2660+
(tickangle === 90 && side === 'top')
2661+
) {
2662+
ff = CAP_SHIFT;
2663+
} else {
2664+
ff = 0.5;
2665+
}
2666+
}
26572667

26582668
out.xFn = function(d) { return d.dx + x0; };
26592669
out.yFn = function(d) { return d.dy + y0 + d.fontSize * ff; };
@@ -2684,7 +2694,6 @@ axes.makeLabelFns = function(ax, shift, angle) {
26842694

26852695
x0 = labelStandoff;
26862696
y0 = labelShift * flipIt;
2687-
var tickangle = ax.tickangle;
26882697
ff = 0;
26892698
if(Math.abs(tickangle) === 90) {
26902699
if(

test/image/baselines/1.png

2 Bytes
Loading
-156 Bytes
Loading
-64 Bytes
Loading
193 Bytes
Loading
-995 Bytes
Loading

0 commit comments

Comments
 (0)