Pie charts: how to prevent labels from overlapping each other

Please see the attached spreadsheet. The label position is set to best fit and the labels don’t overlap.

Run the following program and view the image created by aspose.cells (for your convenience I attached it to this post). You’ll see that labels for Slice 1 & 2 are overlapped. Is there a way to prevent aspose from overlapping pie labels?

private static void TestPieCharts()
{
string path = @“C:\temp\spreadsheets”;
Workbook workbook = new Workbook(path + “test_pie01.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];

foreach (Shape shape in worksheet.Shapes)
{
if (shape.IsGroup)
continue;
ImageOrPrintOptions options = new ImageOrPrintOptions();
options.ImageFormat = ImageFormat.Png;
string fileName = String.Format("{0}.png", Guid.NewGuid());
shape.ToImage(path + fileName, options);

Cell originalTopLeftCell = worksheet.Cells[shape.UpperLeftRow, shape.UpperLeftColumn];
Console.WriteLine(“Cell {0} , shape {1}, top {2}, left {3}, topInShape: {4}, group: {5}”, originalTopLeftCell.Name, shape.Name, shape.Top, shape.Left, shape.TopInShape, shape.Group == null ? “” : shape.Group.Name);
if (worksheet.Cells.IsColumnHidden(originalTopLeftCell.Column) || worksheet.Cells.IsRowHidden(originalTopLeftCell.Row))
{
Console.WriteLine(“Cell is hidden”);
}
}

}

Thanks

Hi Costa,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue. After converting the pie chart into image using the latest version: Aspose.Cells for .NET 8.0.1 labels in pie chart gets overlapped.

We have 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 CELLSNET-42573.

I have tested this issue with the following code and I have attached the output image for a reference.

C#


Workbook workbook = new Workbook(path);


Worksheet worksheet = workbook.Worksheets[0];


Chart ch = worksheet.Charts[0];


Bitmap bmpChart = ch.ToImage();

bmpChart.Save(path + “.out.png”, ImageFormat.Png);

Hi,


Please try our latest version/ fix: Aspose.Cells for .NET v8.3.2.4
We have fixed your issue “CELLSNET-42573” regarding pie data labels overlapping.
Let us know your feedback.

Thank you

The issues you have found earlier (filed as CELLSNET-42573) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.