Bug Description
The global <c:dLbls> template block for pie and doughnut charts hardcodes Arial and sz="1800" instead of using the dataLabelFontFace and dataLabelFontSize options from IChartOpts.
The individual per-slice <c:dLbl> entries correctly use the options (line ~4401 in pptxgen.cjs.js):
strXml += " <a:latin typeface=\"".concat(opts.dataLabelFontFace || 'Arial', "\"/>");
But the global/parent <c:dLbls> block (line ~4421-4422) has them hardcoded:
strXml += " <a:defRPr sz=\"1800\" b=\"...
strXml += ' <a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:latin typeface="Arial"/>';
This means the parent template block always uses Arial at 18pt regardless of what options are passed.
Version
3.12.0
Steps to Reproduce
- Create a pie chart with
dataLabelFontFace: 'Roboto' and dataLabelFontSize: 12
- Open the generated PPTX and inspect the chart XML (
ppt/charts/chartN.xml)
- Observe that individual
<c:dLbl> entries have Roboto at sz="1200", but the parent <c:dLbls> <c:txPr> has Arial at sz="1800"
Expected Behavior
The global <c:dLbls> block should use opts.dataLabelFontFace and opts.dataLabelFontSize (with fallbacks to 'Arial' and DEF_FONT_SIZE), consistent with the individual <c:dLbl> entries and with how other chart types handle this.
Suggested Fix
In makeChartType(), change the global dLbls block for pie/doughnut (around line 4421-4422 in both pptxgen.cjs.js and pptxgen.es.js):
Before:
strXml += " <a:defRPr sz=\"1800\" b=\"".concat(opts.dataLabelFontBold ? '1' : '0', ...);
strXml += ' <a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:latin typeface="Arial"/>';
After:
strXml += " <a:defRPr sz=\"".concat(Math.round((opts.dataLabelFontSize || DEF_FONT_SIZE) * 100), "\" b=\"").concat(opts.dataLabelFontBold ? '1' : '0', ...);
strXml += ' <a:solidFill>' + createColorElement(opts.dataLabelColor || DEF_FONT_COLOR) + '</a:solidFill><a:latin typeface="' + (opts.dataLabelFontFace || 'Arial') + '"/>';
This matches the pattern used in the per-slice <c:dLbl> entries (line ~4399-4401) and in other chart types (bar, line, scatter, bubble).
Bug Description
The global
<c:dLbls>template block for pie and doughnut charts hardcodesArialandsz="1800"instead of using thedataLabelFontFaceanddataLabelFontSizeoptions fromIChartOpts.The individual per-slice
<c:dLbl>entries correctly use the options (line ~4401 inpptxgen.cjs.js):But the global/parent
<c:dLbls>block (line ~4421-4422) has them hardcoded:This means the parent template block always uses Arial at 18pt regardless of what options are passed.
Version
3.12.0
Steps to Reproduce
dataLabelFontFace: 'Roboto'anddataLabelFontSize: 12ppt/charts/chartN.xml)<c:dLbl>entries haveRobotoatsz="1200", but the parent<c:dLbls> <c:txPr>hasArialatsz="1800"Expected Behavior
The global
<c:dLbls>block should useopts.dataLabelFontFaceandopts.dataLabelFontSize(with fallbacks to'Arial'andDEF_FONT_SIZE), consistent with the individual<c:dLbl>entries and with how other chart types handle this.Suggested Fix
In
makeChartType(), change the global dLbls block for pie/doughnut (around line 4421-4422 in bothpptxgen.cjs.jsandpptxgen.es.js):Before:
After:
This matches the pattern used in the per-slice
<c:dLbl>entries (line ~4399-4401) and in other chart types (bar, line, scatter, bubble).