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

Free Support Forum - aspose.com

How to change series order (reverse)?

Hello,
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:
http://office.microsoft.com/en-us/help/reverse-the-plotting-order-of-categories-values-or-series-HP005208626.aspx

Thank you

Hi,

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.

HI,


mshakeel

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

Hi,

Please use the following code to make value axis reversed.

Java


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


Workbook workbook = new Workbook();

workbook.open(path);


//Set the value axis reversed

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

ch.getValueAxis().setPlotOrderReversed(true);


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

Hi,


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.

Hi,


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.

Hi,

I think, you should try one of these.


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

Or

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



Hi,


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.