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

Message ListMessage List     Post MessagePost Message

  Linearscale sometimes causing too much space in bottom row
Posted by Steve on Mar-25-2011 06:46
Attachments:
Hi Peter,

There is too much space on the bottom row (2550-2600) of this financial chart.  Is it possible for the chart to begin at 2600 and end at 2850.   I checked my data and none of the visible prices are below 2600.  Also, I am running mc.layoutAxes(); after setting the mc.yAxis().setLinearScale3(); to prevent other linelayers from effecting the scale.

Thanks for your help.
Steve
bottomrow.png

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Steve on Mar-25-2011 06:52
I am guessing that since it is linear, Chartdirector is doing some sort of calculation to split each tick by 50.  Is there a way to automatically have Chartdirector do the calculation and still have less space at the bottom?  Or is the only possible way is to do my own calculation and set the low and high myself:
mc.yAxis().setLinearScale(2600, 2850);

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Peter Kwan on Mar-25-2011 14:45
Hi Steve,

By default, ChartDirector will extend the axis scale by around 5% on either end, so as to avoid the data representation to "touch the axis". The extension is configurable using Axis.setAutoScale.

Then ChartDirector will extend the axis if necessary to make sure the axis ends at a "tick position". This can be disabled using Axis.setRounding.

For example, suppose the lower limit of your data is 2600. After extending by 5%, it may be 25xx. The next tick position is at 2550 (because the tick increment is 50 units), so the axis starts at 2550.

The tick increment is determined by your data range and how many ticks you can fit given the current chart size and the tick density configuration. The tick density is configurable using Axis.setTickDensity.

So in your case, you may:

(a) Reduce the 5% extension

(b) Disable the axis rounding

(c) Use denser ticks by configuring the tick density.

For example:

mc.yAxis().setRounding(false, false);  //disable axis rounding.

Hope this can help.

Regards
Peter Kwan

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Steve on Apr-12-2011 06:48
Attachments:
Thanks Peter.

I am disabling the rounding, and autoScale

            mc.yAxis().setRounding(false, false);
            mc.yAxis().setMargin(3, 3);
            mc.yAxis().setAutoScale(0,0);

But now I am getting only 2 ticks.  Is there a way to get the same number of ticks that is shown when the scale is set automatically?

I have tried using setTickDensity but it did not work..

Thanks again,
Steve
chart.png

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Peter Kwan on Apr-12-2011 17:58
Hi Steve,

From reading the chart, I think the data range (the difference between the maximum amd minimum data values) is around 230. The usable axis region is 94 pixels. I think ChartDirector believes with the default tick density, there is insufficient space if the label increment is 50 units. So it picks 100 units as the label increment.

If you would prefer to have denser labels, you can try to set a denser value for the tick density. May be you can try:

mc.yAxis().setTickDensity(15);

(You mentioned the setTickDensity does not work. Have you tried to use a value as small as 15? I choose 15 because with your font size, the labels would still be readable with 15 pixels spacing.)

Hope this can help.

Regards
Peter Kwan

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Steve on Apr-13-2011 00:28
Attachments:
thanks Peter,

setting it to 15 worked for those charts.

however, i noticed that when I am making changes to the yAxis

                    mc.yAxis().setRounding(false, false);
                    mc.yAxis().setMargin(3, 3);
                    mc.yAxis().setAutoScale(0, 0);

it sometimes starts at 0 when the price is lower..

is there a way to prevent it from starting from 0?
chart.png
chartfrom0.png

  Re: Linearscale sometimes causing too much space in bottom row
Posted by Peter Kwan on Apr-13-2011 01:24
Hi Steve,

Instead of using setAutoScale(0, 0), you may try setAutoScale(0, 0, 0)

Hope this can help.

Regards
Peter Kwan