This article guides you on how to create a Pie chart in PowerPoint with C# REST API. You will learn how to make a Pie chart in PowerPoint with C# RESTful Service using a .NET-based Cloud SDK. All the steps are performed in the sample code along with the descriptive comments.
Prerequisite
- Create an account API credentials
- Download Aspose.Slides Cloud SDK for Dotnet to make a Pie chart
- Setup C# project with the above SDK to work with Pie graphs in a presentation slide
Steps to Make a Pie Chart in PowerPoint with C# .NET-based API
- Initialize the API client with ID and KEY using the SlidesApi class
- Read the local presentation file and upload it to the Cloud storage
- Create the Pie chart by defining its position, size, and type for configuring it
- Add labels to the chart and create a series of data points for the chart
- Add series to the chart and add this chart to the target slide in the loaded presentation with the CreateShape() method
- Download the presentation to a local file
These steps describe how do you make a Pie chart in PowerPoint with C# RESTful Service. Instantiate the chart object, configure its properties, add categories, and create data points series for adding to the Pie chart. Finally, add the Pie chart to the target slide in the presentation and save on the local disk.
Code to Add Pie Graph in PowerPoint with C# RESTful Service
The above code shows how to create Pie chart in PPT with C# .NET-based API. You may ensure that you add as many series of data collection as the number of categories added in the chart. Also note that loading the presentation in he beginning is must required otherwise you may get exceptions while executing code without uploading the source presentation.
This article has taught us adding a Pie chart in a presentation. To add a bar chart, refer to the article on Create Bar chart in PowerPoint with C# REST API.