Adding syntax to be evaluated by GroupDocs.Assembly engine
Chart title
The foreach tag iterates over the managers, and the x tag defines the category (slice) name. The tags are removed from the title in the report.
Total Contract Price<<foreach [in managers]>><<x [Name]>>
Chart data (Excel)
In the chart’s worksheet, put the y tag into the series name. It defines the value of each slice. The category cells (A–D) can contain any placeholder values: the engine replaces them with data.
Total Contract Price<<y [Contracts.sum(c => c.Price)]>>
'use strict';constgroupdocs=require('@groupdocs/groupdocs.assembly');// "managers" is the data source name used in the chart title
constdataSource=newgroupdocs.JsonDataSource("managers.json");constdataSourceInfo=newgroupdocs.DataSourceInfo(dataSource,"managers");constassembler=newgroupdocs.DocumentAssembler();assembler.assembleDocument("pie-chart-template.pptx","pie-chart-report.pptx",dataSourceInfo);process.exit(0);
Warning
In evaluation mode, GroupDocs.Assembly truncates text read from presentations, so template tags in PowerPoint templates may break and assembly fails. Apply a license (a free temporary license is enough) to run this example.
Result
The generated pie-chart-report.pptx contains a pie chart titled “Total Contract Price” with three slices:
Manager
Total contract price
John Smith
2300000
Tony Anderson
1200000
July James
600000
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.
On this page
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.