Hi,
I’m trying to get some pie chart data labels to be spaced properly, but they are getting generated in a small area and making them illegible. We’re trying the fairly recent “IsNeverOverlap” value to true but that doesn’t seem to be helping.
image.png (18.5 KB)
Sample code:
Sheet.Charts.Add(Aspose.Cells.Charts.ChartType.Pie, 18,0,37,5);
var dest = Sheet.Charts[0];
// general chart defaults
dest.ChartArea.Area.ForegroundColor = Color.White;
dest.PlotArea.Area.ForegroundColor = Color.White;
dest.ChartArea.Border.Weight = Aspose.Cells.Drawing.WeightType.SingleLine;
dest.ChartArea.Border.Color = Color.Black;
dest.Title.Font.IsBold = true;
dest.Title.Text = "Revenues by Source - Business-Type Activities";
dest.NSeries.Add("C8:C14", true);
DataLabels datalabels;
for (int i = 0; i < dest.NSeries.Count; i++) {
datalabels = dest.NSeries[i].DataLabels;
datalabels.ShowCellRange = true;
datalabels.ShowValue = true;
if (isPieChart(dest.Type)) {
datalabels.Position = LabelPositionType.OutsideEnd;
datalabels.ShowLegendKey = true;
datalabels.ShowCategoryName = true;
datalabels.IsNeverOverlap = true;
};
}
dest.NSeries.CategoryData = "A8:A14";
// adjust default chart position
dest.ChartObject.Left = 100;
The sheet in question:
busactrevsource (24).zip (8.2 KB)
I’m using Aspose.Cells for .NET 22.3.0.