Search code examples
androidandroidplot

How to display Y-axis on the rigth side of AndroidPlot chart


I want to display chart with Y-axis on the right side using AndroidPlot library. I tried to use

 plot.getGraphWidget().setRangeAxisPosition(false, false, 0, s)

and

 plot.getGraphWidget().setRangeAxisLeft(false);

But it's useless. Only labels were moved to right side.

Is there any way to draw Y-axis on right side of AndroidPlot chart?


Solution

  • I have found solution. I looked inside the AndroidPlot library and found, that axis drawing by offset named "origin". When you want to draw Y-axis on the right side of chart use this code.

    XYPlot plot;
    ...
    plot.calculateMinMaxVals(); 
    plot.setUserDomainOrigin(plot.getCalculatedMaxX());