Skip to content

Commit

Permalink
adjust vertical ticklabels on x axes
Browse files Browse the repository at this point in the history
  • Loading branch information
archmoj committed Nov 26, 2020
1 parent a7518ec commit 8efa7bd
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/plots/cartesian/axes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2641,7 +2641,7 @@ axes.makeLabelFns = function(ax, shift, angle) {

var side = ax.side;
var axLetter = ax._id.charAt(0);

var tickangle = ax.tickangle;
var endSide;
if(axLetter === 'x') {
endSide =
Expand All @@ -2654,6 +2654,16 @@ axes.makeLabelFns = function(ax, shift, angle) {
x0 = labelShift * flipIt;
y0 = shift + labelStandoff * flipIt;
ff = endSide ? 1 : -0.2;
if(Math.abs(tickangle) === 90) {
if(
(tickangle === -90 && side === 'bottom') ||
(tickangle === 90 && side === 'top')
) {
ff = CAP_SHIFT;
} else {
ff = 0.5;
}
}

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

x0 = labelStandoff;
y0 = labelShift * flipIt;
var tickangle = ax.tickangle;
ff = 0;
if(Math.abs(tickangle) === 90) {
if(
Expand Down
Binary file modified test/image/baselines/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/bar_multiline_labels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/box_grouped-multicategory.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/ticklabelposition-d.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/image/baselines/vertical-tickangles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8efa7bd

Please sign in to comment.