Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Thu Nov 17, 2022 12:16 pm

Hi, I try to set the data label position of a chart. I try to set it to Left. But I get this error: "Position values: Center, InsideBase, InsideEnd, OutsideEnd".


Code: Select all
chart.Series[x].DataLabels.Position = (ChartDataLabelPosition)Enum.Parse(typeof(ChartDataLabelPosition), "Left", true);

'chart.Series[x].DataLabels.Position = (ChartDataLabelPosition)Enum.Parse(typeof(ChartDataLabelPosition), "Left", true)' threw an exception of type 'System.InvalidOperationException'
    Data: {System.Collections.ListDictionaryInternal}
    HResult: -2146233079
    HelpLink: null
    InnerException: null
    Message: "Position values: Center, InsideBase, InsideEnd, OutsideEnd"
    Source: "Spire.Presentation"
    StackTrace: "   at Spire.Presentation.Collections.ChartDataLabelCollection.set_Position(ChartDataLabelPosition value)"
    TargetSite: {Void set_Position(Spire.Presentation.Charts.ChartDataLabelPosition)}

emremert
 
Posts: 4
Joined: Tue Sep 13, 2022 9:57 am

Fri Nov 18, 2022 5:44 am

Hello,

Thanks for your inquiry.
Are you using the latest version of Spire.Presentation7.11.1? If not, please update to it and have a test. To help us accurately investigate your issue and work out a solution for you, please offer the following message, thanks for your assistance in advance.

1) Your input PPT file and the result PPT file you expected, you can attach here or send it to us via email (support@e-iceblue.com).
2) Your full test code that can reproduce your issue.
3) Application type, such as Console App, .NET Framework 4.8.
4) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Fri Nov 25, 2022 9:44 am

Hello,

Hope you are doing well.
Has your problem been effectively solved now? If not, please offer the following message. Thanks for your assistance in advance.
1) Your input PPT file and the result PPT file you expected, you can attach here or send it to us via email (support@e-iceblue.com).
2) Your full test code that can reproduce your issue.
3) Application type, such as Console App, .NET Framework 4.8.
4) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Sat Nov 26, 2022 4:06 pm

Hi,

I tried with Spire.Presentation7.11.1 and got the same error.

I am using .NET 5.
Test environment: Windows 10 64-bit, Regiıon setting: USA.

I attached the example PPTX file.

I can't extract the code that uses your framework. It took too long. I also tried to create an example project.

What about sending a code snippet that modifies the chart data label's position in the attached PPTX file? So I can reproduce the problem and record a video.

Thanks

emremert
 
Posts: 4
Joined: Tue Sep 13, 2022 9:57 am

Mon Nov 28, 2022 10:09 am

Hello,

Thanks for your feedback.
I have some information to tell you:
1) Do you want to achieve the effect of the screenshot1 below? If so, you need to use the following code to achieve it.
Code: Select all
chart.ChartLegend.Position = ChartLegendPositionType.Left;


2) The below code you provided is that setting the position of data label, and you only set these values to it(Center、Inside End、Inside Base、Outside End). As shown in the screenshot2 below. And in the ppt file (chartDataLabelPosition.pptx), I didn’t find the data label.
Code: Select all
chart.Series[1].DataLabels.Position = (ChartDataLabelPosition)Enum.Parse(typeof(ChartDataLabelPosition), "Left", true);


If these message doesn’t help you, please offer the result PPT document you excepted to help us provide solution for you. Thanks for your assistance in advance.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Presentation