We're sorry AsposeCloud doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.cloud

How to create / add pie chart in PowerPoint Presentation Slide in .NET using Aspose.Slides REST API

Hi, I’m using Apose.Slides Cloud API to create PowerPoints with many types of charts.

I was wondering if any in-depth, step-by-step documentation or tutorials exist to create Pie Charts using the Cloud API? I can can see a Chart class that I can create and set up, but I’m not sure how to fill its Series properties, and how to send the pie chart via the REST API method that are available.


We are looking into your requirement and will share the details shortly.


Please find sample .NET code to create Pie Chart in specified PowerPoint Slide using CreatShape API method. We will also add an article to the documentation soon. Please feel free to contact us for any further assistance.

// Get Client ID and Secret from https://dashboard.aspose.cloud/
SlidesApi slidesApi = new SlidesApi(Myid, MyKey);
Aspose.Slides.Cloud.Sdk.Model.Chart dto = new Aspose.Slides.Cloud.Sdk.Model.Chart();
dto.ChartType = Aspose.Slides.Cloud.Sdk.Model.Chart.ChartTypeEnum.Pie;
dto.X = 100;
dto.Y = 100;
dto.Width = 400;
dto.Height = 400;
dto.Title = new ChartTitle { HasTitle = true, Text = "Pie Chart" };

dto.Categories = new System.Collections.Generic.List<ChartCategory>();
dto.Categories.Add(new ChartCategory { Value = "First" });
dto.Categories.Add(new ChartCategory { Value = "Second" });
dto.Categories.Add(new ChartCategory { Value = "Third" });

OneValueSeries series = new OneValueSeries();
series.IsColorVaried = true;
series.DataPoints = new System.Collections.Generic.List<OneValueChartDataPoint>();
series.DataPoints.Add(new OneValueChartDataPoint { Value = 20 });
series.DataPoints.Add(new OneValueChartDataPoint { Value = 50 });
series.DataPoints.Add(new OneValueChartDataPoint { Value = 30 });
dto.Series = new System.Collections.Generic.List<Series>();

slidesApi.CreateShape("TestText.pptx", 2, dto);
1 Like

Thank you so much! This was extremely helpful, and thank you for adding it into documentation.

1 Like