ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Y axis Maximum
Posted by Adrian on Apr-28-2011 03:20
Hi,

Is there a way to force the chart to only display the Y axis until a certain number?

If you look at this example http://www.advsofteng.com/images/symbolline.png
you can see that it reaches up to 100. But are you forcing this Y axis 100 value OR is it just ChartDirector that decided to set it at 100?

I'd like to find a way to tell ChartDirector to stop the Y axis at 100 or 200 or 300 or whatever value I want. Is there a way?

Thanks

  Re: Y axis Maximum
Posted by Peter Kwan on Apr-28-2011 15:52
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

  Re: Y axis Maximum
Posted by Adrian on Apr-30-2011 02:56
That's exactly what I needed. Thank You.