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

Free Support Forum - aspose.com

Pie Chart Coordinate System

I have a pie chart in a plain white slide background in my powerpoint that has a fairly small amount of space (plot area), when the pie chart is rendered, the data label using small area (like less than 10% of the values) is forced by powerpoint to be rendered outside the pie area (behavior similar to setting LabelPosition to LabelPosition.OutsideEnds), the font is white and obviously, I could not see the label being rendered.

In connection with the title, how would I know if the DataLabel is outside the pie chart (not the plot area)?, I could determine the label’s ActualX and ActualY but I don’t have a clue how to determine if the label is actually inside the Pie or not.


I have observed the requirements shared by you and request you to please share the working sample code that you are using on your end along with desired output presentation that you want to generate using Aspose.Slides.

When you set the custom position for chart label then predefined label positions are removed. In order to get the predefined label positions, you don’t need to set the X and Y position for labels.

Hi mudassir.fayyaz,

I am actually not setting the X and Y but I am getting values from it.

foreach(var point in chart.ChartData.Series[0].DataPoints)
        point.Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.FillType = FillType.Solid;
	// l = label, c = chart
	float lx = point.Label.ActualX, ly = point.Label.ActualY, cx = chart.X, cy = chart.Y;

	if (lx <= cx && ly <= cy || lx >= cy && ly <= cy )
		point.Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.SolidFillColor.Color = System.Drawing.Color.Black;
		point.Label.DataLabelFormat.TextFormat.PortionFormat.FillFormat.SolidFillColor.Color = System.Drawing.Color.White;

this is the logic of what I currently have in code, the idea is if the data label is inside the pie chart area, I make the text color to white, if it is outside, set to black but my problem is that other labels are turning into black even when they are inside the pie chart’s area.


I have observed the part of sample code shared by you and have developed understanding about it. However, in order to work properly on requirements, I need the source and desired output presentation on your end along with a working sample code. Please share the requested information so that I may help you further.