Pie chart - First Slice Angle

Howdy,


I am trying to adjust the angle of the first slice in a pie chart. I have tried the method in the Chart object setFirstSliceAngle(int) and the method in the first Series object setFirstSliceAngle(short) and neither of them are working. Am I missing something or are they currently broken?

Hi James,


Thank you for contacting Aspose support.

I have tested the scenario while using the latest version of Aspose.Cells for Java 8.5.1.6 and following piece of code against a sample of my own. I believe the latest revision is working as expected as I have compared the results by rotating the first slice manually in Excel application. Please find the attachment for input & output spreadsheets.

That being said, please check if you are calling Chart.calculate after manipulating the chart.

Java

Workbook workbook = new Workbook(“D:/book1.xlsx”);
Chart chart = workbook.getWorksheets().get(0).getCharts().get(0);
chart.getNSeries().get(0).setFirstSliceAngle((short) 90);
chart.calculate();
workbook.save(“D:/output.xlsx”);

Hi Babar,


Thank you for the quick response. I have checked your code and it appears to be working in your report but it isn’t working for mine. After investigating, I noticed that the FirstSliceAngle works for Pie and PieExploded chart types but 3DPie and 3DPieExploded chart types do not. Could you confirm if you have the same problem?

Hi,

Thanks for your feedback and using Aspose.Cells.

Yes, you are right. FirstSliceAngle works for Pie and PieExploded chart types but does not work for 3D-Pie and 3D-PieExploded.

We have therefore logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSJAVA-41441 - FirstSliceAngle works for Pie and PieExploded chart types but does not work for 3D-Pie and 3D-PieExploded

Hi,

Thanks for using Aspose.Cells for Java.

Please download and try this fix: Aspose.Cells for Java v8.5.2.3 and let us know your feedback.

Please try our latest version Aspose.Cells 21.6.0.

Your issue should be fixed now.
Let us know your feedback.