@@ -1679,27 +1679,39 @@ axes.drawOne = function(gd, ax, opts) {
1679
1679
} ) ;
1680
1680
}
1681
1681
1682
+ var labelFns = axes . makeLabelFns ( ax , ax . _mainLinePosition ) ;
1682
1683
// stash tickLabels selection, so that drawTitle can use it
1683
1684
// to scoot title w/o having to query the axis layer again
1684
1685
ax . _tickLabels = null ;
1685
- var labelFns = axes . makeLabelFns ( ax , ax . _mainLinePosition ) ;
1686
+
1687
+ var seq = [ ] ;
1686
1688
1687
1689
// tick labels - for now just the main labels.
1688
1690
// TODO: mirror labels, esp for subplots
1689
- return axes . drawLabels ( gd , ax , {
1690
- vals : vals ,
1691
- layer : mainPlotinfo [ axLetter + 'axislayer' ] ,
1692
- // TODO shouldn't need this
1693
- shift : ax . _mainLinePosition ,
1694
- // TODO calcBoundingBox should be taken out of drawLabels
1695
- subplotsWithAx : subplotsWithAx ,
1696
- transFn : transFn ,
1697
- labelXFn : labelFns . labelXFn ,
1698
- labelYFn : labelFns . labelYFn ,
1699
- labelAnchorFn : labelFns . labelAnchorFn ,
1700
- // TODO call drawTitle after drawLabels
1701
- skipTitle : opts . skipTitle
1691
+ seq . push ( function ( ) {
1692
+ return axes . drawLabels ( gd , ax , {
1693
+ vals : vals ,
1694
+ layer : mainPlotinfo [ axLetter + 'axislayer' ] ,
1695
+ // TODO shouldn't need this
1696
+ shift : ax . _mainLinePosition ,
1697
+ // TODO calcBoundingBox should be taken out of drawLabels
1698
+ subplotsWithAx : subplotsWithAx ,
1699
+ transFn : transFn ,
1700
+ labelXFn : labelFns . labelXFn ,
1701
+ labelYFn : labelFns . labelYFn ,
1702
+ labelAnchorFn : labelFns . labelAnchorFn ,
1703
+ } ) ;
1702
1704
} ) ;
1705
+
1706
+ if ( ! opts . skipTitle &&
1707
+ ! ( ( ax . rangeslider || { } ) . visible && ax . _boundingBox && ax . side === 'bottom' )
1708
+ ) {
1709
+ seq . push ( function ( ) {
1710
+ return axes . drawTitle ( gd , ax ) ;
1711
+ } ) ;
1712
+ }
1713
+
1714
+ return Lib . syncOrAsync ( seq ) ;
1703
1715
} ;
1704
1716
1705
1717
/**
@@ -1911,12 +1923,10 @@ axes.drawLabels = function(gd, ax, opts) {
1911
1923
1912
1924
if ( ! isNumeric ( opts . shift ) ) {
1913
1925
tickLabels . remove ( ) ;
1914
- axes . drawTitle ( gd , ax , opts ) ;
1915
1926
return ;
1916
1927
}
1917
1928
if ( ! ax . showticklabels ) {
1918
1929
tickLabels . remove ( ) ;
1919
- axes . drawTitle ( gd , ax , opts ) ;
1920
1930
calcBoundingBox ( ) ;
1921
1931
return ;
1922
1932
}
@@ -2087,13 +2097,6 @@ axes.drawLabels = function(gd, ax, opts) {
2087
2097
}
2088
2098
ax . _lastangle = autoangle ;
2089
2099
}
2090
-
2091
- // update the axis title
2092
- // (so it can move out of the way if needed)
2093
- // TODO: separate out scoot so we don't need to do
2094
- // a full redraw of the title (mostly relevant for MathJax)
2095
- axes . drawTitle ( gd , ax , opts ) ;
2096
- return axId + ' done' ;
2097
2100
}
2098
2101
2099
2102
function calcBoundingBox ( ) {
@@ -2223,18 +2226,7 @@ axes.drawLabels = function(gd, ax, opts) {
2223
2226
return done ;
2224
2227
} ;
2225
2228
2226
- axes . drawTitle = function ( gd , ax , opts ) {
2227
- opts = opts || { } ;
2228
-
2229
- // Now this only applies to regular cartesian axes; colorbars and
2230
- // others ALWAYS call doTicksSingle with skipTitle=true so they can
2231
- // configure their own titles.
2232
- //
2233
- // Rangeslider takes over a bottom title so drop it here
2234
- if ( opts . skipTitle ||
2235
- ( ( ax . rangeslider || { } ) . visible && ax . _boundingBox && ax . side === 'bottom' )
2236
- ) return ;
2237
-
2229
+ axes . drawTitle = function ( gd , ax ) {
2238
2230
var fullLayout = gd . _fullLayout ;
2239
2231
var tickLabels = ax . _tickLabels ;
2240
2232
0 commit comments