Skip to content

Commit bdf312b

Browse files
committed
include "sign of arrow starting at axis pointing towards margin"
... into `Axes.getTickSigns` output
1 parent 304e4d3 commit bdf312b

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/plots/cartesian/axes.js

+9-6
Original file line numberDiff line numberDiff line change
@@ -1832,7 +1832,6 @@ axes.drawOne = function(gd, ax, opts) {
18321832

18331833
if(ax.type === 'multicategory') {
18341834
var pad = {x: 2, y: 10}[axLetter];
1835-
var sgn = {l: -1, t: -1, r: 1, b: 1}[ax.side.charAt(0)];
18361835

18371836
seq.push(function() {
18381837
var bboxKey = {x: 'height', y: 'width'}[axLetter];
@@ -1846,24 +1845,23 @@ axes.drawOne = function(gd, ax, opts) {
18461845
repositionOnUpdate: true,
18471846
secondary: true,
18481847
transFn: transFn,
1849-
labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * sgn)
1848+
labelFns: axes.makeLabelFns(ax, mainLinePosition + standoff * tickSigns[4])
18501849
});
18511850
});
18521851

18531852
seq.push(function() {
1854-
ax._depth = sgn * (getLabelLevelBbox('tick2')[ax.side] - mainLinePosition);
1853+
ax._depth = tickSigns[4] * (getLabelLevelBbox('tick2')[ax.side] - mainLinePosition);
18551854

18561855
return drawDividers(gd, ax, {
18571856
vals: dividerVals,
18581857
layer: mainAxLayer,
1859-
path: axes.makeTickPath(ax, mainLinePosition, sgn, ax._depth),
1858+
path: axes.makeTickPath(ax, mainLinePosition, tickSigns[4], ax._depth),
18601859
transFn: transFn
18611860
});
18621861
});
18631862
} else if(ax.title.hasOwnProperty('standoff')) {
18641863
seq.push(function() {
1865-
var sgn = {l: -1, t: -1, r: 1, b: 1}[ax.side.charAt(0)];
1866-
ax._depth = sgn * (getLabelLevelBbox()[ax.side] - mainLinePosition);
1864+
ax._depth = tickSigns[4] * (getLabelLevelBbox()[ax.side] - mainLinePosition);
18671865
});
18681866
}
18691867

@@ -2100,6 +2098,7 @@ function calcLabelLevelBbox(ax, cls) {
21002098
* - [1]: sign for bottom/left ticks (i.e. positive SVG direction)
21012099
* - [2]: sign for ticks corresponding to 'ax.side'
21022100
* - [3]: sign for ticks mirroring 'ax.side'
2101+
* - [4]: sign of arrow starting at axis pointing towards margin
21032102
*/
21042103
axes.getTickSigns = function(ax) {
21052104
var axLetter = ax._id.charAt(0);
@@ -2110,6 +2109,10 @@ axes.getTickSigns = function(ax) {
21102109
if((ax.ticks !== 'inside') === (axLetter === 'x')) {
21112110
out = out.map(function(v) { return -v; });
21122111
}
2112+
// independent of `ticks`; do not flip this one
2113+
if(ax.side) {
2114+
out.push({l: -1, t: -1, r: 1, b: 1}[ax.side.charAt(0)]);
2115+
}
21132116
return out;
21142117
};
21152118

0 commit comments

Comments
 (0)