Hi Adrian,
For the sample code that generates the chart http://www.advsofteng.com/images/symbolline.png, the upper scale 100 is automatically determined by ChartDirector. ChartDirector will use the actual data to determine the upper axis scale. It may add some margin and round the upper limit to a "nice number" (eg. it may not use 97.235072 as the upper limit, but may round to 100). The auto-scaling behaviour is configurable using Axis.setAutoScale, Axis.setRounding and Axis.setTickDensity.
If you would like to set the upper limit with your own code, you may use Axis.setLinearScale. For example, in Java:
//y-axis range 0 - 100 with a label every 20 units
c.yAxis().setLinearScale(0, 100, 20);
//lower limit is automatically determined, and upper limit should use be close to myUpperLimit
c.yAxis().setLinearScale(Chart.NoValue, myUpperLimit);
In the second case above, ChartDirector may not use exactly myUpperLimit if it is not a "nice number" (say if you set myUpperLimit to 97.23507123095782, ChartDirector may round it to a "nice number"). If you want ChartDirector not to round the given upper limit, you may use:
//round lower limit if necessary, but not upper limit
c.yAxis().setRounding(true, false);
Hope this can help.
Regards
Peter Kwan |