@@ -1832,7 +1832,6 @@ axes.drawOne = function(gd, ax, opts) {
1832
1832
1833
1833
if ( ax . type === 'multicategory' ) {
1834
1834
var pad = { x : 2 , y : 10 } [ axLetter ] ;
1835
- var sgn = { l : - 1 , t : - 1 , r : 1 , b : 1 } [ ax . side . charAt ( 0 ) ] ;
1836
1835
1837
1836
seq . push ( function ( ) {
1838
1837
var bboxKey = { x : 'height' , y : 'width' } [ axLetter ] ;
@@ -1846,24 +1845,23 @@ axes.drawOne = function(gd, ax, opts) {
1846
1845
repositionOnUpdate : true ,
1847
1846
secondary : true ,
1848
1847
transFn : transFn ,
1849
- labelFns : axes . makeLabelFns ( ax , mainLinePosition + standoff * sgn )
1848
+ labelFns : axes . makeLabelFns ( ax , mainLinePosition + standoff * tickSigns [ 4 ] )
1850
1849
} ) ;
1851
1850
} ) ;
1852
1851
1853
1852
seq . push ( function ( ) {
1854
- ax . _depth = sgn * ( getLabelLevelBbox ( 'tick2' ) [ ax . side ] - mainLinePosition ) ;
1853
+ ax . _depth = tickSigns [ 4 ] * ( getLabelLevelBbox ( 'tick2' ) [ ax . side ] - mainLinePosition ) ;
1855
1854
1856
1855
return drawDividers ( gd , ax , {
1857
1856
vals : dividerVals ,
1858
1857
layer : mainAxLayer ,
1859
- path : axes . makeTickPath ( ax , mainLinePosition , sgn , ax . _depth ) ,
1858
+ path : axes . makeTickPath ( ax , mainLinePosition , tickSigns [ 4 ] , ax . _depth ) ,
1860
1859
transFn : transFn
1861
1860
} ) ;
1862
1861
} ) ;
1863
1862
} else if ( ax . title . hasOwnProperty ( 'standoff' ) ) {
1864
1863
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 ) ;
1867
1865
} ) ;
1868
1866
}
1869
1867
@@ -2100,6 +2098,7 @@ function calcLabelLevelBbox(ax, cls) {
2100
2098
* - [1]: sign for bottom/left ticks (i.e. positive SVG direction)
2101
2099
* - [2]: sign for ticks corresponding to 'ax.side'
2102
2100
* - [3]: sign for ticks mirroring 'ax.side'
2101
+ * - [4]: sign of arrow starting at axis pointing towards margin
2103
2102
*/
2104
2103
axes . getTickSigns = function ( ax ) {
2105
2104
var axLetter = ax . _id . charAt ( 0 ) ;
@@ -2110,6 +2109,10 @@ axes.getTickSigns = function(ax) {
2110
2109
if ( ( ax . ticks !== 'inside' ) === ( axLetter === 'x' ) ) {
2111
2110
out = out . map ( function ( v ) { return - v ; } ) ;
2112
2111
}
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
+ }
2113
2116
return out ;
2114
2117
} ;
2115
2118
0 commit comments