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.

Wed Dec 04, 2019 4:58 pm

Hello,

I'm evaluating the free Spire.Presentation version 4.11.12.10040 and trying to create a line chart in a PowerPoint document. I have most of it working except for the following 2 issues:

1) When I open the PowerPoint presentation, the dates shown on the axis are not my Category dates - they start at '96 instead of '91 (see attached screenshot: incorrect_dates_1.png). But if I then right-click on the chart and select "Edit Data" the Category dates change to the correct years, almost like they are refreshed? (see attached screenshot: date_years_now_correct_2.png). Note that the month is shown as Jan when it should be Dec (see attached screenshot: month_still_incorrect_3.png).
2) Even after the dates have been updated, the Major Unit Value is not set based on the fact that it is still "Auto". The code sets both the BaseUnitScale (which looks like it was set) and the MajorUnitScale / MajorUnit (see attached screenshot: major_unit_not_set_4.png)

I have also attached the code I am using for reference (see attached test.cs).

Thank you!
John

jcostello
 
Posts: 4
Joined: Wed Dec 04, 2019 3:44 pm

Thu Dec 05, 2019 7:35 am

Hi,

Thanks for your inquiry.
I have noticed the issues and posted it to our Dev team. We will let you know as soon as there is any update.
Sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Dec 18, 2019 10:09 am

Hi,

Thanks for waiting.
Now the issue is solved in Spire.Presentation Pack Hotfix Version:4.12.13.
Our website link: https://www.e-iceblue.com/Download/down ... t-now.html
NuGet link: https://www.nuget.org/packages/Spire.Pr ... on/4.12.13

Note if you want that the month displays correctly, you need to change ChartBaseUnitType as month.
Code: Select all
            chart.PrimaryCategoryAxis.BaseUnitScale = Spire.Presentation.Charts.ChartBaseUnitType.Months;


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Dec 18, 2019 2:39 pm

Thanks Betsy, this looks great!

Do you know if there will eventually be a fix so that the Label dates will actually be the Month-Date of the the data points - even if we want to show Labels only every 3 years? For example, if I have only March dates then the chart would show the corresponding March date every 3 years. We are currently doing this with Excel charting using Epplus and I think the executive team has grown accustomed to it.

Thanks again!
John

jcostello
 
Posts: 4
Joined: Wed Dec 04, 2019 3:44 pm

Thu Dec 19, 2019 6:11 am

Hi John,

According to your information, I think you could add the data labels you want. Please try to use following code:
Code: Select all
            for (int i = 0; i < chart.Series.Count; i++)
            {
                ChartSeriesDataFormat series = chart.Series[i];
                for (int j = 0; j < series.Values.Count; j = j + 3 )
                {
                    ChartDataLabel label = series.DataLabels.Add();
                    label.ID = j;
                    label.LabelValueVisible = true;
                }
            }

If this doesn't meet your requirement, please provide the desired PPT file for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Dec 19, 2019 2:14 pm

Thanks for the quick response Betsy!

It looks like the Series Data Labels are actually the labels for the data points along the line itself (not the text labels along the Category axis below). I've added your code snippet and attached the resulting PowerPoint.

Thanks - John

jcostello
 
Posts: 4
Joined: Wed Dec 04, 2019 3:44 pm

Fri Dec 20, 2019 6:46 am

Hi,

Thanks for your response.
Yes, the data label is for the data points along the line itself. It seems you want to add the custom text. Please refer to following code to change the datalabel:
Code: Select all
                for (int j = 0; j < series.Values.Count; j = j + 3 )
                {
                    ChartDataLabel label = series.DataLabels.Add();
                    label.ID = j;
                    label.LabelValueVisible = true;
                    //Change the datalal to the text you want
                    label.TextFrame.Paragraphs[0].Text = "Changed";
                }

If you still have the issue, please provide a desired result(You could create it by MS PowerPoint) for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Dec 20, 2019 2:12 pm

Thanks Betsy,

I was really trying to just get the Category Label to show every 3 years, but have the Month part of the date still display correctly. I realized from the previous post that I could do this by changing the Base Unit type to Months, and then specify a MajorUnit of 36 instead of 3 (when the Base Unit was years).

So I'm all set now. Thanks so much for assisting me with this!

- John

jcostello
 
Posts: 4
Joined: Wed Dec 04, 2019 3:44 pm

Mon Dec 23, 2019 1:47 am

Hi John,

Glad to hear that you have managed to solve your issue.
If there is any question while using our product, please feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Presentation