@@ -411,11 +411,18 @@ exports.drawMainTitle = function(gd) {
411
411
propContainer : fullLayout ,
412
412
propName : 'title.text' ,
413
413
placeholder : fullLayout . _dfltTitle . plot ,
414
+ attributes : ( {
415
+ x : x ,
416
+ y : y ,
417
+ 'text-anchor' : textAnchor ,
418
+ dy : dy
419
+ } )
414
420
} ) ;
415
421
416
- var titleObj = d3 . selectAll ( '.gtitle' ) ;
422
+
417
423
418
424
if ( title . text && title . automargin ) {
425
+ var titleObj = d3 . selectAll ( '.gtitle' ) ;
419
426
var titleHeight = Drawing . bBox ( titleObj . node ( ) ) . height ;
420
427
var pushMargin = needsMarginPush ( gd , title , titleHeight ) ;
421
428
if ( pushMargin > 0 ) {
@@ -424,16 +431,18 @@ exports.drawMainTitle = function(gd) {
424
431
dy = getMainTitleDy ( fullLayout ) ;
425
432
y = getMainTitleY ( fullLayout , dy ) ;
426
433
applyTitleAutoMargin ( gd , y , pushMargin , titleHeight ) ;
434
+
435
+ // Position the title once we know where it needs to be
436
+ titleObj . attr ( {
437
+ x : x ,
438
+ y : y ,
439
+ 'text-anchor' : textAnchor ,
440
+ dy : dy
441
+ } ) . call ( svgTextUtils . positionText , x , y ) ;
427
442
}
428
443
}
429
444
430
- // Position the title once we know where it needs to be
431
- titleObj . attr ( {
432
- x : x ,
433
- y : y ,
434
- 'text-anchor' : textAnchor ,
435
- dy : dy
436
- } ) . call ( svgTextUtils . positionText , x , y ) ;
445
+
437
446
} ;
438
447
439
448
0 commit comments