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

Free Support Forum - aspose.com

How to change series order (reverse)?

We are using Java Aspose.cells, how it is possible to chage categories order in chart ?

Smth like in excel you can via click on Axis:
[x] Categories in reverse order.

I have found method: com.aspose.cells.NSeries#changeSeriesOrder(int sourceIndex, int destIndex)
But I need one method to change everything at once places.

link to microsoft description:

Thank you


Thanks for your question.

Please provide me a source workbook matching your requirements. I have created one, please check if you are looking for this thing.



Thank you for quick response.
I have attached source_request.xlsx - with description, what is wrong and how we want to make.


Please use the following code to make value axis reversed.


String path = “F:\Shak-Data-RW\Downloads\source_request.xlsx”;

Workbook workbook = new Workbook();


//Set the value axis reversed

Chart ch= workbook.getWorksheets().getSheet(0).getCharts().getChart(0);


workbook.save(path + “.out.xlsx”);


Thank you for hint.

I have used this code:
Chart ch= workbook.getWorksheets().getSheet(0).getCharts().getChart(0);
ch.getCategoryAxis().setReversed( true );

And it works fine.

Thank you for help.


One more question.

I have understood : How it is possible to make categories in reverse order.

But when you make categories reverse, not only them are changed,
also values appear on the top of chart, insted of to be on the bottom.
(this we don’t want to have)

See attached file with more info.

Thank you for help.


I think, you should try one of these.

1 - ch.getValueAxis().setTickLabelPosition(TickLabelPositionType.LOW);


2 - ch.getCategoryAxis().setTickLabelPosition(TickLabelPositionType.LOW);


Thank you very much. This is exactly property I need to change.

In my case I need to do the following:

ch.getCategoryAxis().setReversed( true );
ch.getValueAxis().setTickLabelPosition( TickLabelPositionType.HIGH );

seems like in reversed mode LOW and HIGH working in opposite way also.