@@ -322,7 +322,7 @@ module.exports = function plot(gd, cdpie) {
322322
323323 // add the title
324324 var titleTextGroup = d3 . select ( this ) . selectAll ( 'g.titletext' )
325- . data ( trace . title ? [ 0 ] : [ ] ) ;
325+ . data ( trace . title . text ? [ 0 ] : [ ] ) ;
326326
327327 titleTextGroup . enter ( ) . append ( 'g' )
328328 . classed ( 'titletext' , true ) ;
@@ -334,18 +334,18 @@ module.exports = function plot(gd, cdpie) {
334334 s . attr ( 'data-notex' , 1 ) ;
335335 } ) ;
336336
337- titleText . text ( trace . title )
337+ titleText . text ( trace . title . text )
338338 . attr ( {
339339 'class' : 'titletext' ,
340340 transform : '' ,
341341 'text-anchor' : 'middle' ,
342342 } )
343- . call ( Drawing . font , trace . titlefont )
343+ . call ( Drawing . font , trace . title . font )
344344 . call ( svgTextUtils . convertToTspans , gd ) ;
345345
346346 var transform ;
347347
348- if ( trace . titleposition === 'middle center' ) {
348+ if ( trace . title . position === 'middle center' ) {
349349 transform = positionTitleInside ( cd0 ) ;
350350 } else {
351351 transform = positionTitleOutside ( cd0 , fullLayout . _size ) ;
@@ -473,11 +473,11 @@ function prerenderTitles(cdpie, gd) {
473473 cd0 = cdpie [ i ] [ 0 ] ;
474474 trace = cd0 . trace ;
475475
476- if ( trace . title ) {
476+ if ( trace . title . text ) {
477477 var dummyTitle = Drawing . tester . append ( 'text' )
478478 . attr ( 'data-notex' , 1 )
479- . text ( trace . title )
480- . call ( Drawing . font , trace . titlefont )
479+ . text ( trace . title . text )
480+ . call ( Drawing . font , trace . title . font )
481481 . call ( svgTextUtils . convertToTspans , gd ) ;
482482 var bBox = Drawing . bBox ( dummyTitle . node ( ) , true ) ;
483483 cd0 . titleBox = {
@@ -579,7 +579,7 @@ function positionTitleInside(cd0) {
579579 y : cd0 . cy ,
580580 scale : cd0 . trace . hole * cd0 . r * 2 / textDiameter ,
581581 tx : 0 ,
582- ty : - cd0 . titleBox . height / 2 + cd0 . trace . titlefont . size
582+ ty : - cd0 . titleBox . height / 2 + cd0 . trace . title . font . size
583583 } ;
584584}
585585
@@ -602,25 +602,25 @@ function positionTitleOutside(cd0, plotSize) {
602602 // we reason below as if the baseline is the top middle point of the text box.
603603 // so we must add the font size to approximate the y-coord. of the top.
604604 // note that this correction must happen after scaling.
605- translate . ty += trace . titlefont . size ;
605+ translate . ty += trace . title . font . size ;
606606 maxPull = getMaxPull ( trace ) ;
607607
608- if ( trace . titleposition . indexOf ( 'top' ) !== - 1 ) {
608+ if ( trace . title . position . indexOf ( 'top' ) !== - 1 ) {
609609 topMiddle . y -= ( 1 + maxPull ) * cd0 . r ;
610610 translate . ty -= cd0 . titleBox . height ;
611611 }
612- else if ( trace . titleposition . indexOf ( 'bottom' ) !== - 1 ) {
612+ else if ( trace . title . position . indexOf ( 'bottom' ) !== - 1 ) {
613613 topMiddle . y += ( 1 + maxPull ) * cd0 . r ;
614614 }
615615
616- if ( trace . titleposition . indexOf ( 'left' ) !== - 1 ) {
616+ if ( trace . title . position . indexOf ( 'left' ) !== - 1 ) {
617617 // we start the text at the left edge of the pie
618618 maxWidth = plotSize . w * ( trace . domain . x [ 1 ] - trace . domain . x [ 0 ] ) / 2 + cd0 . r ;
619619 topMiddle . x -= ( 1 + maxPull ) * cd0 . r ;
620620 translate . tx += cd0 . titleBox . width / 2 ;
621- } else if ( trace . titleposition . indexOf ( 'center' ) !== - 1 ) {
621+ } else if ( trace . title . position . indexOf ( 'center' ) !== - 1 ) {
622622 maxWidth = plotSize . w * ( trace . domain . x [ 1 ] - trace . domain . x [ 0 ] ) ;
623- } else if ( trace . titleposition . indexOf ( 'right' ) !== - 1 ) {
623+ } else if ( trace . title . position . indexOf ( 'right' ) !== - 1 ) {
624624 maxWidth = plotSize . w * ( trace . domain . x [ 1 ] - trace . domain . x [ 0 ] ) / 2 + cd0 . r ;
625625 topMiddle . x += ( 1 + maxPull ) * cd0 . r ;
626626 translate . tx -= cd0 . titleBox . width / 2 ;
@@ -774,7 +774,7 @@ function scalePies(cdpie, plotSize) {
774774 pieBoxWidth = plotSize . w * ( trace . domain . x [ 1 ] - trace . domain . x [ 0 ] ) ;
775775 pieBoxHeight = plotSize . h * ( trace . domain . y [ 1 ] - trace . domain . y [ 0 ] ) ;
776776 // leave some space for the title, if it will be displayed outside
777- if ( trace . title && trace . titleposition !== 'middle center' ) {
777+ if ( trace . title . text && trace . title . position !== 'middle center' ) {
778778 pieBoxHeight -= getTitleSpace ( cd0 , plotSize ) ;
779779 }
780780
@@ -784,7 +784,7 @@ function scalePies(cdpie, plotSize) {
784784
785785 cd0 . cx = plotSize . l + plotSize . w * ( trace . domain . x [ 1 ] + trace . domain . x [ 0 ] ) / 2 ;
786786 cd0 . cy = plotSize . t + plotSize . h * ( 1 - trace . domain . y [ 0 ] ) - pieBoxHeight / 2 ;
787- if ( trace . title && trace . titleposition . indexOf ( 'bottom' ) !== - 1 ) {
787+ if ( trace . title . text && trace . title . position . indexOf ( 'bottom' ) !== - 1 ) {
788788 cd0 . cy -= getTitleSpace ( cd0 , plotSize ) ;
789789 }
790790
0 commit comments