Free Support Forum - aspose.com

Setting Value for min and max in secondary vertical axis of chart

Hi,
In my project I am facing the mentioned problem. I am using aspose licensed version 16.8.0 java
I have created 2 series of stack column type and i want to set one series with primary axis value and second series with secondary axis value…i have written code for same but its not working

This is the code snippet for Secondary Axis
IAxis vAxis=iChart.getAxes().getSecondaryVerticalAxis();
IAxis hAxis=iChart.getAxes().getSecondaryHorizontalAxis();

vAxis.setAutomaticMajorUnit(true);
vAxis.setAutomaticMinorUnit(true);

vAxis.setAutomaticMaxValue(false);
vAxis.setMaxValue(102596);

vAxis.setAutomaticMinValue(false);
vAxis.setMinValue(0);

vAxis.setVisible(false);
hAxis.setVisible(false);

This is the code snippet for Primary Axis
IAxis vAxis=iChart.getAxes().getVerticalAxis();
IAxis hAxis=iChart.getAxes().getHorizontalAxis();

vAxis.setAutomaticMajorUnit(true);
vAxis.setAutomaticMinorUnit(true);

vAxis.setAutomaticMaxValue(false);
vAxis.setMaxValue(55265);

vAxis.setAutomaticMinValue(false);
vAxis.setMinValue(0);

vAxis.setVisible(false);
hAxis.setVisible(false);

I have also attached a generated ppt for the said problem
testsecondary.zip (185.1 KB)

Kindly provide solution for the same

@Rutuja,

I have observed your comments. Can you please try to use PlotOnSecondAxis and i have also shared code snippet this will help you to achieve requirements. Also please use Aspose.Slides latest version 17.7 on your end. Please share feedback with us if there is still an issue.

IChartSeries targetSeries = ch.getChartData().getSeries().get_Item(1);
targetSeries.setPlotOnSecondAxis(true);