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

Free Support Forum - aspose.com

Doughnet chart is not generating

Hi ,
I am using PPT Template for generating PPT , In PPT template i have doughnut chart but i am geting as pie chart. my code is like this,
public void UpdateTemplateDoughnutChart(ISlide _slide, DataTable dt, string chartname, string currentColumn, string catName, Color col1, Color col2)
foreach (IShape _shp in _slide.Shapes)
if (_shp.GetType().Name == "Chart" && _shp.Name == chartname)
Aspose.Slides.Charts.IChart chart = (Aspose.Slides.Charts.IChart)_shp;

//Setting the index of chart data sheet
int defaultWorksheetIndex = 0;

//Getting the chart data worksheet
Aspose.Slides.Charts.IChartDataWorkbook fact = chart.ChartData.ChartDataWorkbook;

//Delete default generated series and categories

//Adding new categories
for (int i = 0; i < dt.Rows.Count; i++)
chart.ChartData.Categories.Add(fact.GetCell(0, i + 1, 0, dt.Rows[i][0].ToString()));

//Adding new series
Aspose.Slides.Charts.IChartSeries series = chart.ChartData.Series.Add(fact.GetCell(0, 0, 1, "ser1"), chart.Type);

//Now populating series data
Aspose.Slides.Charts.IDataLabel lbl1;
for (int i = 0; i < dt.Rows.Count; i++)
series.DataPoints.AddDataPointForDoughnutSeries(fact.GetCell(defaultWorksheetIndex, i + 1, 1, Get_DoubleValue(dt.Rows[i][1].ToString())));
lbl1 = series.DataPoints[i].Label;
lbl1.DataLabelFormat.ShowValue = false;
lbl1.DataLabelFormat.ShowLegendKey = false;
lbl1.DataLabelFormat.ShowPercentage = false;

chart.ChartData.SeriesGroups[0].IsColorVaried = true;

Aspose.Slides.Charts.IChartDataPoint point = series.DataPoints[0];
point.Format.Fill.FillType = FillType.Solid;
point.Format.Fill.SolidFillColor.Color = col1;
//Setting Sector border
point.Format.Line.FillFormat.FillType = FillType.Solid;
point.Format.Line.FillFormat.SolidFillColor.Color = Color.Gray;
point.Format.Line.Width = 1.0;
point.Format.Line.Style = LineStyle.ThinThick;
point.Format.Line.DashStyle = LineDashStyle.Solid;

Aspose.Slides.Charts.IChartDataPoint point1 = series.DataPoints[1];
point1.Format.Fill.FillType = FillType.Solid;
point1.Format.Fill.SolidFillColor.Color = col2;

//Setting Sector border
point1.Format.Line.FillFormat.FillType = FillType.Solid;
point1.Format.Line.FillFormat.SolidFillColor.Color = Color.Gray;
point1.Format.Line.Width = 1.0;
point1.Format.Line.Style = LineStyle.Single;
point1.Format.Line.DashStyle = LineDashStyle.Solid;

//Showing Leader Lines for Chart
series.Labels.DefaultDataLabelFormat.ShowLeaderLines = false;

//Setting Rotation Angle for Pie Chart Sectors
chart.ChartData.SeriesGroups[0].FirstSliceAngle = 180;
chart.HasLegend = false;
series.ParentSeriesGroup.Overlap = 10;

Hi Anand,

Thank you for your interest in Aspose.Slides.

I have observed your comments and worked with the code sample shared by you. I have not been able to reproduce the issue. I request you to please share with us a narrowed down sample application, instead of pasting the code, so that we may reproduce the issue on our end by executing that application. Please also share the template presentation with us. Make sure you are using Aspose.Slides for .NET 15.7.0 on your end. I will be able to proceed further as soon as the requested information is shared by you.

Best Regards,