Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Fri Dec 21, 2018 10:46 am

Hi

I do not seem to be able to use the PrimaryCategoryAxis MajorUnit successfully. If I use it on the PrimaryValueAxis it works as expected.

Code: Select all
chart.PrimaryCategoryAxis.MajorUnit = 1.0;
chart.PrimaryCategoryAxis.MinorUnit = 1.0;


Whatever I use for the value has no effect on the output.

abarnett
 
Posts: 5
Joined: Thu Dec 20, 2018 9:19 am

Mon Dec 24, 2018 2:08 am

Hi,

Thank you for your inquiry.
Try to add the code before setting the major unit.
Code: Select all
chart.PrimaryCategoryAxis.CategoryType = CategoryType.Category;

If the issue still bothers you, please provide your input Excel file(if any) as well as the complete code to help us look into the issue accurately. Then we will share the solution accordingly.

Sincerely,
Jane
E-ice blue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Dec 27, 2018 2:42 am

Hi,

Greetings from e-iceblue!
Have you tried the code? Could you please give us some feedback?
Thank you in advance!

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Jan 02, 2019 9:38 am

Hi,

Thank you for your response.

If I try the suggested code I get the error: 'This property is not supported for the current chart type'.

I have attached the code.
Attachments
Program.zip
(1.88 KiB) Downloaded 204 times

abarnett
 
Posts: 5
Joined: Thu Dec 20, 2018 9:19 am

Wed Jan 02, 2019 10:17 am

Hi,

Thank you for your feedback.
Kindly note that you can't set the PrimaryCategoryAxis.MajorUnits property before the data range is set. Please put the PrimaryCategoryAxis settings at the end of the method "CreateChart2". I have tested the case and could confirm it works well.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Wed Jan 02, 2019 2:19 pm

That is great. :D

Thank you.

abarnett
 
Posts: 5
Joined: Thu Dec 20, 2018 9:19 am

Thu Jan 03, 2019 1:22 am

Hi,

Thank you for your feedback.
Just feel free to contact us if you need any assistance in the future. :)

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.XLS