Hi, I am trying to set the tick label position for secondary axis, but it is not getting set. Below is the code that I am trying to set TickLabelPositionType.NEXT_TO_AXIS to a secondary axis, but when I open the xls file it not getting set.
Sample code.
Workbook workbook = new Workbook();
WorksheetCollection worksheets = workbook.getWorksheets();
worksheets.removeAt(0);
Worksheet dataSheet = worksheets.add("Data");
Worksheet chartSheet = worksheets.get(worksheets
.add(SheetType.CHART));
chartSheet.setName("Chart");
worksheets.setActiveSheetIndex(chartSheet.getIndex());Chart chart = chartSheet.getCharts().get(
chartSheet.getCharts().add(ChartType.COLUMN_STACKED, 0, 0,
50, 50));Cells cells = dataSheet.getCells();
cells.get("A1").setValue("Product Name");
cells.get("B1").setValue("Quarter 1");
cells.get("C1").setValue("Quarter 2");
cells.get("D1").setValue("Quarter 3");
cells.get("E1").setValue("Quarter 4");
cells.get("A2").setValue("Product 1");
cells.get("B2").setValue(33);
cells.get("C2").setValue(21);
cells.get("D2").setValue(35);
cells.get("E2").setValue(22);
cells.get("A3").setValue("Product 2");
cells.get("B3").setValue(17);
cells.get("C3").setValue(54);
cells.get("D3").setValue(17);
cells.get("E3").setValue(60);
cells.get("A4").setValue("Product 3");
cells.get("B4").setValue(50);
cells.get("C4").setValue(25);
cells.get("D4").setValue(48);
cells.get("E4").setValue(18);
cells.get("A5").setValue("Avg Line");
cells.get("B5").setValue(0);
cells.get("C5").setValue(0);
cells.get("D5").setValue(0);
cells.get("E5").setValue(0);chart.getNSeries().setCategoryData("=Data!B1:E1");
int index = chart.getNSeries().add("=Data!B2:E2", false);
chart.getNSeries().get(index).setName("=Data!A2");index = chart.getNSeries().add("=Data!B3:E3", false);
chart.getNSeries().get(index).setName("=Data!A3");index = chart.getNSeries().add("=Data!B4:E4", false);
chart.getNSeries().get(index).setName("=Data!A4");index = chart.getNSeries().add("=Data!B5:E5", false);
chart.getNSeries().get(index).setXValues("=Data!A1:A4");
chart.getNSeries().get(index).setName("=Data!A5");
chart.getNSeries().get(index).setType(ChartType.LINE);
chart.getNSeries().get(index).setPlotOnSecondAxis(true);chart.getCategoryAxis().setVisible(false);
chart.getSecondCategoryAxis().setVisible(true);
chart.getSecondCategoryAxis().setTickLabelPosition(
TickLabelPositionType.NEXT_TO_AXIS);
chart.getSecondValueAxis().setPlotOrderReversed(true);workbook.save("stacekd bar second axis.xls");
But this problem happens, only when setPlotOrderReversed() is set to 'true' for the second value axis. when this line is commented, the tick label position is getting set properly.,
I wanted to show the secondary category axis, in the chart.
Any help would be appreciated?
Regards
Sundhar