Hi Team,
We have a requirement to render a combination chart with stacked column in primary axis and Stacked Area in Secondary axis.
Whenever I turn off the axis property the Stacked Area chart is not getting rendered.
I am attaching the sample code which I have used below
Workbook workbook = new Workbook(dir + "DAC Stacked Bar + Area.xlsx");
int index = workbook.getWorksheets().add();
ChartCollection charts = workbook.getWorksheets().get(index).getCharts();
index = charts.add(ChartType.COLUMN_STACKED, 0, 0, 33, 15);
Chart chart = charts.get(index);
chart.getWorksheet().setGridlinesVisible(false);
chart.getPlotArea().getArea().getFillFormat().setFillType(FillType.NONE);
chart.getNSeries().add("='1-DataSheet'!B6:C11", true);
chart.getNSeries().get(0).getDataLabels().setShowValue(false);
Series AreaSeries = chart.getNSeries().get(chart.getNSeries().getCount() - 1);
AreaSeries.setPlotOnSecondAxis( true);
AreaSeries.setType(ChartType.AREA_STACKED);
chart.calculate();
Axis valueAxis = chart.getValueAxis();
valueAxis.getMajorGridLines().setVisible(false);
valueAxis.setVisible(false);
valueAxis.setAutomaticMinValue(true);
valueAxis.setAutomaticMaxValue(true);
valueAxis.setAutomaticMajorUnit(true);
valueAxis.setAutomaticMinorUnit(true);
Axis categoryAxis = chart.getCategoryAxis();
categoryAxis.setVisible(false);
categoryAxis.setAutomaticMinValue(true);
categoryAxis.setAutomaticMaxValue(true);
categoryAxis.setAutomaticMajorUnit(true);
categoryAxis.setAutomaticMinorUnit(true);
Axis secValueAxis = chart.getSecondValueAxis();
Axis secCategoryAxis = chart.getSecondCategoryAxis();
secValueAxis.setVisible(false);
secCategoryAxis.setVisible(false);
secValueAxis.setAutomaticMinValue(true);
secValueAxis.setAutomaticMaxValue(true);
secValueAxis.setAutomaticMajorUnit(true);
secValueAxis.setAutomaticMinorUnit(true);
secCategoryAxis.setAutomaticMinValue(true);
secCategoryAxis.setAutomaticMaxValue(true);
secCategoryAxis.setAutomaticMajorUnit(true);
secCategoryAxis.setAutomaticMinorUnit(true);
workbook.save(dir +"AreaWithBar.xlsx");
System.out.println("done");
When axis is turned off - Area is not rendered.
image.png (53.2 KB)
When axis is turned on - Area rendered.
image.png (62.4 KB)
I am attaching the source and output files FYR.
InputAndOutputFiles.zip (27.7 KB)
Could you please check and let me know why the Stacked Area is not getting rendered when we trun off the axis ?
Thanks,
Thilak Babu