SecondValueAxis series displaying inverted

I have a chart I’m generating that has 2 series. The first column on the primary axis and the second an area on the secondary axis. I’ve tried everything that I can think of and no matter what I do the area is rendering upside down. I’ve included sample code and the resulting xlsx file. I’m using aspose-cells-7.5.2.


Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);

Cells cells = worksheet.getCells();

cells.get(“B3”).setValue(“12/15/13”);
cells.get(“B4”).setValue(“12/22/13”);

cells.get(“C3”).setValue(6);
cells.get(“C4”).setValue(7);

cells.get(“D3”).setValue(17);
cells.get(“D4”).setValue(40);

int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 2, 5, 22, 15);
Chart chart = worksheet.getCharts().get(chartIndex);


chart.getNSeries().add(“C3:C4”, true);
chart.getNSeries().setCategoryData(“B3:B4”);


chart.getNSeries().add(“D3:D4”, true);
chart.getNSeries().setCategoryData(“B3:B4”);
chart.getNSeries().get(1).setType(ChartType.AREA);
chart.getNSeries().get(1).setPlotOnSecondAxis(true);

chart.getSecondValueAxis().setVisible(true);
workbook.save(“C:\isolated.xlsx”);

Hi,


Please add a line to your code snippet (see the line in bold) for your needs:
e.g
Sample code:

Workbook workbook = new Workbook();
Worksheet worksheet = workbook.getWorksheets().get(0);

Cells cells = worksheet.getCells();

cells.get(“B3”).setValue(“12/15/13”);
cells.get(“B4”).setValue(“12/22/13”);

cells.get(“C3”).setValue(6);
cells.get(“C4”).setValue(7);

cells.get(“D3”).setValue(17);
cells.get(“D4”).setValue(40);

int chartIndex = worksheet.getCharts().add(ChartType.COLUMN, 2, 5, 22, 15);
Chart chart = worksheet.getCharts().get(chartIndex);


chart.getNSeries().add(“C3:C4”, true);
chart.getNSeries().setCategoryData(“B3:B4”);


chart.getNSeries().add(“D3:D4”, true);
chart.getNSeries().setCategoryData(“B3:B4”);
chart.getNSeries().get(1).setType(ChartType.AREA);
chart.getNSeries().get(1).setPlotOnSecondAxis(true);

chart.getSecondValueAxis().setVisible(true);
chart.getSecondValueAxis().setCrossAt(0);

workbook.save(“C:\isolated.xlsx”);



I never would have guessed it but that fixed the issue I was having.

Hi,


Good to know that it sorts out your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.