Skip to content

Commit 1a1d0c7

Browse files
committed
add support for metatext for pie title.text
1 parent f755bcb commit 1a1d0c7

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/traces/pie/plot.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,11 @@ module.exports = function plot(gd, cdpie) {
334334
s.attr('data-notex', 1);
335335
});
336336

337-
titleText.text(trace.title.text)
337+
var txt = fullLayout.metatext ?
338+
Lib.templateString(trace.title.text, {metatext: fullLayout.metatext}) :
339+
trace.title.text;
340+
341+
titleText.text(txt)
338342
.attr({
339343
'class': 'titletext',
340344
transform: '',
@@ -467,16 +471,22 @@ function determineInsideTextFont(trace, pt, layoutFont) {
467471
}
468472

469473
function prerenderTitles(cdpie, gd) {
474+
var fullLayout = gd._fullLayout;
475+
470476
var cd0, trace;
471477
// Determine the width and height of the title for each pie.
472478
for(var i = 0; i < cdpie.length; i++) {
473479
cd0 = cdpie[i][0];
474480
trace = cd0.trace;
475481

476482
if(trace.title.text) {
483+
var txt = fullLayout.metatext ?
484+
Lib.templateString(trace.title.text, {metatext: fullLayout.metatext}) :
485+
trace.title.text;
486+
477487
var dummyTitle = Drawing.tester.append('text')
478488
.attr('data-notex', 1)
479-
.text(trace.title.text)
489+
.text(txt)
480490
.call(Drawing.font, trace.title.font)
481491
.call(svgTextUtils.convertToTspans, gd);
482492
var bBox = Drawing.bBox(dummyTitle.node(), true);

0 commit comments

Comments
 (0)