Skip to content

Commit

Permalink
Merge pull request 'adds the possibility to control the legend per su…
Browse files Browse the repository at this point in the history
…btype in the combo chart. If the legend is active in the combo chart, but the parameter showLegend is false in one of the subcharts, then the series objects of this subchart are excluded from the legend' (gitbrent#1) from feature-combochart-hide-legend-from-subtype into master

Reviewed-on: http://gitea.mla.local/mla-libraries/PptxGenJS/pulls/1
  • Loading branch information
Nikita Kotlyarevskyy committed Jul 16, 2024
2 parents 981a11d + e498346 commit 7d35684
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/gen-charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,19 @@ export function makeXmlCharts (rel: ISlideRelChart): string {
strXml += ' </a:p>'
strXml += '</c:txPr>'
}
if (Array.isArray(rel.opts._type)) {
rel.opts._type.forEach(type => {
const showLegend = type.options.showLegend
if (!showLegend) {
type.data.forEach(obj => {
strXml += ' <c:legendEntry>'
strXml += ` <c:idx val="${obj._dataIndex}"/>`
strXml += ' <c:delete val="1"/>'
strXml += ' </c:legendEntry>'
})
}
})
}
strXml += '</c:legend>'
}
}
Expand Down

0 comments on commit 7d35684

Please sign in to comment.