I have attached sample Excel pie chart, mainly in that i want to show data label with custom data formatted vales and percentage.
Hi,
Thanks for your posting and using Aspose.Cells.
Please use the following properties to format your Pie Chart Data Labels.
- DataLabels.ShowCategoryName
- DataLabels.ShowPercentage
- DataLabels.ShowValue
If you also want to show Leader Lines, then please use this property
- Chart.NSeries[0].HasLeaderLines
Please see the following code for your reference. It formats the pie chart data labels. I have also attached the source xlsx file used in this code and output xlsx file generated by this code for you to view. Also attached the screenshot showing the comparison of source and output file.
C#
//Create workbook
Workbook workbook = new Workbook(“source.xlsx”);
//Access the worksheet
Worksheet worksheet = workbook.Worksheets[0];
//Access the Pie Chart
Chart ch = worksheet.Charts[0];
//Format the DataLabels of Chart Series
DataLabels dataLabels = ch.NSeries[0].DataLabels;
dataLabels.ShowCategoryName = true;
dataLabels.ShowPercentage = true;
dataLabels.ShowValue = true;
//Show the Leader Lines
ch.NSeries[0].HasLeaderLines = true;
//Save the workbook
workbook.Save(“output.xlsx”);
With The Same i tried But still i am not getting Border for label as show in sample and Number Format for Value how to Change its given cell value only.
Hi,
Thanks for your posting and using Aspose.Cells.
The output.xlsx file I provided to you has the same Pie Chart as you have provided in your Test Pie Chart.xlsx.
If you need something else, then please provide us your sample Pie Chart and highlight your issue in a screenshot so that we could look into it precisely and help you asap.
Hi,
Hi,
Hi,
Hi,
Yes this behavior in MS Excel, but how can we achieve in default it should show proper.
Hi,
Hi,
Hi,