chart.CategoryAxis.GetAxisTexts() are not the same as what excel shows

hi ,

i have an excel file:
4366-20250303.7z (108.4 KB)

there is an chart.
i ues the below codes to get the lables:

var chart = sheet.Charts.OrderByDescending(t => t.ChartObject.LowerRightRow).First();

var labels = chart.CategoryAxis.GetAxisTexts()

the labels are not the same shown in ms excel .

i am using aspose.cells 24.12.0

please have a look.

thank you.

@vs6060_qq_com,

Please try to call Chart.Calculate() method before retrieving the category axis labels. I tested your scenario/case with your template Excel file and using latest version/fix: Aspose.Cells for .NET v25.5, it works fine and as expected.
e.g.,
Sample code:

Workbook workbook = new Workbook("e:\\test2\\4366-20250303.xlsx");
Worksheet sheet = workbook.Worksheets[3];
var chart = sheet.Charts.OrderByDescending(t => t.ChartObject.LowerRightRow).First();

chart.Calculate();

// Get the axis labels
string[] axisLabels = chart.CategoryAxis.GetAxisTexts();

// Print the axis labels to console
Console.WriteLine("Category Axis Labels:");
if (axisLabels != null)
{
    foreach (var label in axisLabels)
    {
        Console.WriteLine(label);
    }
}

console output:

Category Axis Labels:
0.1
0.25
0.3
0.5
1
90
250
250.1
575
1000
1025
1850
2450
2525
3000
3010
3525
4025
4500
4525
5175
5700
5825
6000

sorry ,my mistekn

please see the latest excel file.
4366-20250303.7z (108.4 KB)

the below is what ms excel shows:

Screenshot 2025-05-23 182030.jpg (40.3 KB)

@vs6060_qq_com,

I tested your scenario/case with your newly attached template Excel file using our latest version/fix: Aspose.Cells for .NET v25.5 (please try it), it works fine and as expected. I got the same output as shown in previous reply.

See the screenshot on how the category axis labels are shown in MS Excel (2019) on my end:
sc_shot1.png (111.4 KB)

hi,

please do the blowe change on my excel file:
Screenshot 2025-05-23 193238.jpg (217.9 KB)

change the parameter from 45 to 0,
the axis labes are changed,

but when i run the below codes,
string[] axisLabels = chart.CategoryAxis.GetAxisTexts();
still get the avlues including 6000.

please have a look
thank you very much.

@vs6060_qq_com,

Thanks for providing further details and screenshots.

I simply opened your template Excel file into MS Excel and did your suggested change for the chart’s axis labels as per your screenshot. I re-saved the file as “4366-20250303_new1.xlsx”. I then tested your scenario/case with the the file and using latest version/fix: Aspose.Cells for .NET v25.5:

Workbook workbook = new Workbook("e:\\test2\\4366-20250303_new1.xlsx");
Worksheet sheet = workbook.Worksheets[3];
var chart = sheet.Charts.OrderByDescending(t => t.ChartObject.LowerRightRow).First();

chart.Calculate();

// Get the axis labels
string[] axisLabels = chart.CategoryAxis.GetAxisTexts();

// Print the axis labels to console
Console.WriteLine("Category Axis Labels:");
if (axisLabels != null)
{
    foreach (var label in axisLabels)
    {
        Console.WriteLine(label);
    }
}

console output:

Category Axis Labels:
0.1
0.25
0.3
0.5
1
90
250
250.1
575
1000
1025
1850
2450
2525
3000
3010
3525
4025
4500
4525
5175
5700
5825
6000

4366-20250303_new1.zip (108.5 KB)

So, the output is not matching with the axis labels of the chart as shown in MS Excel. We require thorough evaluation of the issue. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-58452

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

hi,

any update of this issue?

@vs6060_qq_com,

We are currently looking into your issue and will check if we can provide the latest updates or an estimated timeframe for resolution. We will get back to you soon.

Hi @vs6060_qq_com
This issue is expected to be resolved in version 25.7, scheduled for release in early July.

The issues you have found earlier (filed as CELLSNET-58452) have been fixed in this update. This message was posted using Bugs notification tool by leoluo