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

Free Support Forum - aspose.com

Overlapping Data Labels in PowerPoint Line Charts Using Aspose.Slides for .NET

Hello,

currently I am having the issue, that some values overlap each other in my line chart and some of them even overlap the line itself. Any idea how to avoid this? Thanks in advance :slightly_smiling_face:

Overlap.png (17.9 KB)

@ChartsDev,
Thank you for contacting support.

Please check your results using the latest version of Aspose.Slides if it is possible. If the issue persists, please share the following data and information:

  • input and output files (you can zip the files and upload an archive here)
  • code example that reproduces the problem
  • OS version on which the code was executed
  • .NET target platform in your app
  • Aspose.Slides version you used

Hello,

thank you for your reply and sorry that it took me so long to respond. I have prepared a demo project which creates a line chart showing the mentioned issue. I am using Aspose.Slides version 22.12.0 with the .NET target platform 472 on Windows. Attached, you can find the demo project.

Thank you for your time.

AsposeChart.zip (6.1 KB)

@ChartsDev,
Thank you for the sample project. I will get back to you ASAP.

@ChartsDev,
Unfortunately, there does not seem to be a setting in PowerPoint documents automatically forces chart data labels to show without overlapping. You can reduce the font size of the chart data labels to avoid this problem like this:

series.Labels.DefaultDataLabelFormat.TextFormat.PortionFormat.FontHeight = 10;

Result: example.png (23.0 KB)

Documents: Chart Data Label

Thank you again for your response. Is this a known issue? Is it maybe going to be solved in the future?

@ChartsDev,
PowerPoint charts only allow you to change the position of chart data labels to Center, Left, Right, Above, and Below of the point. FormatDataLabels.png (8.3 KB). With Aspose.Slides, you can achieve the same like this:

series.Labels.DefaultDataLabelFormat.Position = LegendDataLabelPosition.Top;

There are no settings to avoid the label overlapping, but you can try to get the best label placement by positioning some of the data labels (even or odd, for example) individually, as shown below:

series.Labels[index].DataLabelFormat.Position = LegendDataLabelPosition.Bottom;

Thanks again, we will try to get the best result with the code you have shown. :slightly_smiling_face:

@ChartsDev,
Please feel free to ask any questions if you are having difficulty with this.