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

Free Support Forum - aspose.com

Issue in Axis options values of a chart

Hi,

We are using Aspose cells Java 17.8.
Value of Major/minor units of vertical axis are returned wrong using the following methods.

System.out.println(chart.getValueAxis().getMajorUnit());
System.out.println(chart.getValueAxis().getMinorUnit());

It prints:
0.0
0.0

Whereas it should print:
0.1
0.02

Can you please let me now what is getting wrong here.

Attached excel and screenshot of the Axis options I am referring to.

Thanks,
Neeraj

Capture.PNG (36.5 KB)
TestAxisOptions.zip (12.1 KB)

@neergupta,

Thanks for the template file and sample code segment.

Please add a line before getting the major and minor units, it should work fine:
e.g
Sample code:

chart.calculate(); 

Let us know if you still find any issue.

Thank you.

Thanks for your response.
I did try chart.calculate() however, it gives me the following output:
0.2
0.02
whereas the expected is
0.1
0.02

Can you please verify?

Thanks,
Neeraj

@neergupta,

Thanks for providing further details.

After an initial test, I observed the issue as you mentioned by using the following sample code with your template file. I found that after using Chart.calculate() method, still the value of major units of axis in the chart is returned wrong:
e.g
Sample code:

Workbook workbook = new Workbook("f:\\files\\TestAxisOptions.xlsx"); 
Worksheet sheet = workbook.getWorksheets().get(0); 
Cells cells = sheet.getCells(); 


Chart chart = sheet.getCharts().get(0); 

chart.calculate(); 

System.out.println(chart.getValueAxis().getMajorUnit());//0.2 - Not Ok 
System.out.println(chart.getValueAxis().getMinorUnit());//0.02 - Ok 

I have logged a ticket with an id “CELLSJAVA-42377” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

@neergupta,

Please try our latest version/fix: Aspose.Cells for Java v17.8.7:

Your issue should be fixed in it.

Let us know your feedback.

Hello,

I have tested the issue using Aspose cells 17.8.7 as suggested by you. However, the problem still appears.
It still shows major axis value as 0.2 instead of 0.1. Kindly verify.

Thanks,
Neeraj

@neergupta,

Yes, I noticed the issue as you mentioned. I guess this could be due to the fact that major axis values are set automatic (you may confirm this in MS Excel). Anyways, I have reopened your issue again. Our concerned developer from product team will evaluate it soon.

@neergupta,

I think we have already told you that when major units are set to automatic, we cannot do well as MS Excel. In short, I’m afraid this type of issue is not easy to be fixed.

Anyways, the issue is still open and if we could make any progress to figure it out, we will let you know here.

The issue has been sorted out in Aspose.Cells for Java 17.9.

Please note, we did enhance the rendering but it might not be perfect. See the previous post: