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.

Mon Oct 04, 2021 3:49 pm

Is this option supported in Spire.Presentation?

waleedez
 
Posts: 3
Joined: Fri Aug 28, 2020 12:40 pm

Tue Oct 05, 2021 2:47 am

Hello,

Thanks for your inquiry.
Our Spire.Presentation does not have a direct function to support this option. But you can get the data of the corresponding range in ChartData and customize the DataLabel to achieve your purpose. Please refer to the following code to test. If there is any question, please feel free to write back.
Code: Select all
    Presentation ppt = new Presentation();
    ppt.LoadFromFile("Test.pptx");
    IChart chart = ppt.Slides[0].Shapes[0] as IChart;
    ChartDataLabel cd = chart.Series[0].DataLabels.Add();
    cd.TextFrame.Paragraphs[0].DefaultCharacterProperties.FontHeight = 11f;
    //Get the value of the range(D1) in chart data.
    cd.TextFrame.Paragraphs[0].Text = chart.ChartData["D1"].Text+ ","+chart.Series[0].Values[0].Text;
    ppt.SaveToFile("output.pptx", FileFormat.Pptx2013);

chartData.png

result.png
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Tue Oct 05, 2021 1:02 pm

Thank you for your answer. This is a known method but the idea was to make datalabels dynamically linked to chart worksheet so their values would be automatically changed if underlying data in the specified range got changed.

waleedez
 
Posts: 3
Joined: Fri Aug 28, 2020 12:40 pm

Wed Oct 06, 2021 2:34 am

Hello,

Thanks for your feedback.
I am sorry that our Spire.Presentation does not support this option now. But we have added it as a new feature with the ticket SPIREPPT-1701 to the upgrade list. If it is achieved in the future, we will let you know.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Wed Oct 06, 2021 10:40 am

Thank you, Brian for your update. Is there a rough timeframe when this feature will be released?

waleedez
 
Posts: 3
Joined: Fri Aug 28, 2020 12:40 pm

Thu Oct 07, 2021 3:19 am

Hello,

Thanks for your feedback!

Sorry that we cannot provide an approximate time for the release of this feature at this time. Once there is any progress regarding the ticket SPIREPPT-1701, we will notify you immediately.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Nov 12, 2021 10:24 am

Hello waleedez,

Greetings from E-iceblue!
Glad to inform you that we just released Spire.Presentation Pack Hotfix Version:6.11.2 which fixes the issue SPIREPPT-1701, please download it from the following links to test on your side. Looking forward to your test result.
Website link: https://www.e-iceblue.com/Download/down ... t-now.html
Nuget link: https://www.nuget.org/packages/Spire.Pr ... ion/6.11.2

Sample code:
Code: Select all
Presentation ppt = new Presentation();
IChart chart = ppt.Slides[0].Shapes.AppendChart(ChartType.ColumnStacked, new RectangleF(100, 100, 500, 400));
CellRange cellRange = chart.ChartData["F1"];
cellRange.Text = "aaa";
cellRange = chart.ChartData["F2"];
cellRange.Text = "bbb";
cellRange = chart.ChartData["F3"];
cellRange.Text = "ccc";
cellRange = chart.ChartData["F4"];
cellRange.Text = "ddd";

chart.Series[0].DataLabelRanges = chart.ChartData["F1", "F4"];
ChartDataLabel dataLabel1 = chart.Series[0].DataLabels.Add();
dataLabel1.ID = 0;
dataLabel1.LabelValueVisible = true;

dataLabel1.ShowDataLabelsRange = true;


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.Presentation