This short tutorial guides you on how to make a pie chart in PowerPoint using C#. It contains the configuration details and detailed steps to add a basic pie chart to the PowerPoint presentation. You can create pie chart in PowerPoint using C# with the help of a couple of lines of codes however you may modify it to add more details according to your requirements and save it on the disk in the desired format like PPTX, PPT, etc.
Steps to Make a Pie Chart in PowerPoint using C#
- Set the development environment to add Aspose.Slides using the NuGet package manager
- Create a new Presentation class object
- Access the first slide in the newly created presentation
- Access shapes collection from the selected slide
- Add a chart in the shapes collection by providing chart type, position, and size
- Set chart parameters having default data series and categories
- Save the presentation on the disk
These steps basically describe how to make a chart in PowerPoint using C# by sharing steps to create a pie chart for demonstration. A new presentation object is created and then guidance is provided to access the first slide and then its shapes collection where the chart is to be added. A simple pie chart with default properties is added and saved on the disk using the Presentation.Save() method.
Code to Create Pie Chart in PowerPoint using C#
This code demonstrates how to make a graph in PowerPoint using C# where chart type pie is used however you can create other types of charts as well like ClusteredColumn, Column3D, Line, Area, Contour, Bubble, Radar, etc. to name a very few. You can set chart data within a chart using series and categories, series data points, chart title, formatting, sidewall, rotation, plot area, etc.
In this tutorial, we learned how to create a pie chart in PowerPoint using C#. If you want to add some image watermark in a presentation, refer to the article on how to add image watermark in PPTX presentation using C#.