@@ -184,7 +184,6 @@ module.exports = function draw(gd, id) {
184
184
showticksuffix : opts . showticksuffix ,
185
185
ticksuffix : opts . ticksuffix ,
186
186
title : opts . title ,
187
- titlefont : opts . titlefont ,
188
187
showline : true ,
189
188
anchor : 'free' ,
190
189
side : 'right' ,
@@ -219,11 +218,11 @@ module.exports = function draw(gd, id) {
219
218
// save for other callers to access this axis
220
219
component . axis = cbAxisOut ;
221
220
222
- if ( [ 'top' , 'bottom' ] . indexOf ( opts . titleside ) !== - 1 ) {
223
- cbAxisOut . titleside = opts . titleside ;
221
+ if ( [ 'top' , 'bottom' ] . indexOf ( opts . title . side ) !== - 1 ) {
222
+ cbAxisOut . title . side = opts . title . side ;
224
223
cbAxisOut . titlex = opts . x + xpadFrac ;
225
224
cbAxisOut . titley = yBottomFrac +
226
- ( opts . titleside === 'top' ? lenFrac - ypadFrac : ypadFrac ) ;
225
+ ( opts . title . side === 'top' ? lenFrac - ypadFrac : ypadFrac ) ;
227
226
}
228
227
229
228
if ( opts . line . color && opts . tickmode === 'auto' ) {
@@ -286,15 +285,15 @@ module.exports = function draw(gd, id) {
286
285
var axisLayer = container . select ( '.cbaxis' ) ;
287
286
288
287
var titleHeight = 0 ;
289
- if ( [ 'top' , 'bottom' ] . indexOf ( opts . titleside ) !== - 1 ) {
288
+ if ( [ 'top' , 'bottom' ] . indexOf ( opts . title . side ) !== - 1 ) {
290
289
// draw the title so we know how much room it needs
291
290
// when we squish the axis. This one only applies to
292
291
// top or bottom titles, not right side.
293
292
var x = gs . l + ( opts . x + xpadFrac ) * gs . w ,
294
- fontSize = cbAxisOut . titlefont . size ,
293
+ fontSize = cbAxisOut . title . font . size ,
295
294
y ;
296
295
297
- if ( opts . titleside === 'top' ) {
296
+ if ( opts . title . side === 'top' ) {
298
297
y = ( 1 - ( yBottomFrac + lenFrac - ypadFrac ) ) * gs . h +
299
298
gs . t + 3 + fontSize * 0.75 ;
300
299
}
@@ -308,7 +307,7 @@ module.exports = function draw(gd, id) {
308
307
}
309
308
310
309
function drawAxis ( ) {
311
- if ( [ 'top' , 'bottom' ] . indexOf ( opts . titleside ) !== - 1 ) {
310
+ if ( [ 'top' , 'bottom' ] . indexOf ( opts . title . side ) !== - 1 ) {
312
311
// squish the axis top to make room for the title
313
312
var titleGroup = container . select ( '.cbtitle' ) ,
314
313
titleText = titleGroup . select ( 'text' ) ,
@@ -339,7 +338,7 @@ module.exports = function draw(gd, id) {
339
338
// TODO: configurable
340
339
titleHeight += 5 ;
341
340
342
- if ( opts . titleside === 'top' ) {
341
+ if ( opts . title . side === 'top' ) {
343
342
cbAxisOut . domain [ 1 ] -= titleHeight / gs . h ;
344
343
titleTrans [ 1 ] *= - 1 ;
345
344
}
@@ -460,8 +459,8 @@ module.exports = function draw(gd, id) {
460
459
} ) ;
461
460
} ,
462
461
function ( ) {
463
- if ( [ 'top' , 'bottom' ] . indexOf ( opts . titleside ) === - 1 ) {
464
- var fontSize = cbAxisOut . titlefont . size ,
462
+ if ( [ 'top' , 'bottom' ] . indexOf ( opts . title . side ) === - 1 ) {
463
+ var fontSize = cbAxisOut . title . font . size ,
465
464
y = cbAxisOut . _offset + cbAxisOut . _length / 2 ,
466
465
x = gs . l + ( cbAxisOut . position || 0 ) * gs . w + ( ( cbAxisOut . side === 'right' ) ?
467
466
10 + fontSize * ( ( cbAxisOut . showticklabels ? 1 : 0.5 ) ) :
@@ -473,7 +472,7 @@ module.exports = function draw(gd, id) {
473
472
drawTitle ( 'h' + cbAxisOut . _id + 'title' , {
474
473
avoid : {
475
474
selection : d3 . select ( gd ) . selectAll ( 'g.' + cbAxisOut . _id + 'tick' ) ,
476
- side : opts . titleside ,
475
+ side : opts . title . side ,
477
476
offsetLeft : gs . l ,
478
477
offsetTop : 0 ,
479
478
maxShift : fullLayout . width
@@ -526,11 +525,11 @@ module.exports = function draw(gd, id) {
526
525
. node ( ) ,
527
526
titleWidth ;
528
527
if ( mathJaxNode &&
529
- [ 'top' , 'bottom' ] . indexOf ( opts . titleside ) !== - 1 ) {
528
+ [ 'top' , 'bottom' ] . indexOf ( opts . title . side ) !== - 1 ) {
530
529
titleWidth = Drawing . bBox ( mathJaxNode ) . width ;
531
530
}
532
531
else {
533
- // note: the formula below works for all titlesides ,
532
+ // note: the formula below works for all title sides ,
534
533
// (except for top/bottom mathjax, above)
535
534
// but the weird gs.l is because the titleunshift
536
535
// transform gets removed by Drawing.bBox
@@ -559,7 +558,7 @@ module.exports = function draw(gd, id) {
559
558
container . selectAll ( '.cboutline' ) . attr ( {
560
559
x : xLeft ,
561
560
y : yTopPx + opts . ypad +
562
- ( opts . titleside === 'top' ? titleHeight : 0 ) ,
561
+ ( opts . title . side === 'top' ? titleHeight : 0 ) ,
563
562
width : Math . max ( thickPx , 2 ) ,
564
563
height : Math . max ( outerheight - 2 * opts . ypad - titleHeight , 2 )
565
564
} )
0 commit comments