Hello, we’re having issues with a bubble chart that has several points landing in the same spot.
For 4 or fewer points, we can use LegendDataLabelPosition
, but not sure how we can handle more than 4.
Our code is below:
// Set label position to avoid overlapping, cycling through valid options
switch (valueTracker[point] % 5)
{
case 0:
dataPoint.Label.DataLabelFormat.Position = LegendDataLabelPosition.Bottom;
break;
case 1:
dataPoint.Label.DataLabelFormat.Position = LegendDataLabelPosition.Left;
break;
case 2:
dataPoint.Label.DataLabelFormat.Position = LegendDataLabelPosition.Right;
break;
case 3:
dataPoint.Label.DataLabelFormat.Position = LegendDataLabelPosition.Top;
break;
default:
dataPoint.Label.DataLabelFormat.Position = LegendDataLabelPosition.Center;
break;
}
@bwisorger,
Thank you for posting the question.
Unfortunately, I don’t yet understand what your problem is. Could you please share a presentation file with an original chart and a presentation with the expected result? You can zip the files and upload an archive here.
Hi there, see the attached zip file with an image of the expected result and the current slides.
The amounts are not the same but the expected image shows what we’re going for - when bubbles are clustered together, an ability to move the label outside of the bubble and connect with an arrow line instead.
Archive 3.zip (299.2 KB)
@bwisorger,
Thank you for the additional information. I am working on the issue and will get back to you soon.
@bwisorger,
Thank you for your patience. As I understand it, you need to shift the chart data labels in the PowerPoint presentation in the direction depending on the location of the bubbles. This cannot be done automatically, it is an algorithmic task. You should analyze the position of the bubbles and adjust their location as below:
// Instead, use your calculated values here.
dataPoint.Label.X = 0.05f;
dataPoint.Label.Y = 0.05f;
Chart Data Label|Aspose.Slides Documentation