Forcing automatic axis recalculation?

TeeChart for ActiveX, COM and ASP
Post Reply
Roger Nye
Newbie
Newbie
Posts: 10
Joined: Tue Aug 17, 2004 4:00 am

Forcing automatic axis recalculation?

Post by Roger Nye » Tue Aug 19, 2008 11:00 am

Hi,
I am using an automatic left axis on a chart (IAxis.Automatic property is true), and adjusting the bottom axis with the IAxis.Minimum /Maximum properties.

When I first load the data, the left axis range is very good.

If I later shrink the range on the bottom axis and the range of visible y-values becomes smaller and I would like the left axis to rescale itself automatically to match the visible data.

Is there a way to force this recalculation, or is the left axis range determined by the data loaded, including that out of sight?

I still want to leave the full range of data in the chart, so the user can drag the chart back to a different range of x-values.

Many thanks
Roger

Yeray
Site Admin
Site Admin
Posts: 9586
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed Aug 20, 2008 8:09 am

Hi Roger,

I think that you should use MinVisibleSeriesValue and MaxVisibleSeriesValue to calculate the new SetMinMax values for your Left axis.

Code: Select all

TChart1.Axis.Left.SetMinMax TChart1.Axis.Left.MinVisibleSeriesValue(True, 0), TChart1.Axis.Left.MaxVisibleSeriesValue(True, 0)
TChart1.Axis.Left.MinimumOffset = 10
TChart1.Axis.Left.MaximumOffset = 10
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Roger Nye
Newbie
Newbie
Posts: 10
Joined: Tue Aug 17, 2004 4:00 am

Almost there

Post by Roger Nye » Wed Aug 20, 2008 2:26 pm

Hi Yeray,
Thanks, that is clearly in the right direction, but I suspect it needs some sort of internal refresh or recalculation first.

What I am doing following your post is:
1. set the min/max of the bottom axis
2. calculating the visible min and max on the left axis
3. setting the min/max on the left axis

What it is doing in step 2 is giving me the vertical range that looks correct before step 1. So if I shrink the x-range, the y-range stays large and if I expand the x-range again, the y-range goes small.

Is there something I should be doing as step 1.5 to ensure that step 2 uses the updated x-range?

Many thanks
Roger

Yeray
Site Admin
Site Admin
Posts: 9586
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Thu Aug 21, 2008 8:11 am

Hi Roger,

Yeah, maybe it lefts an InternalRepaint to force teechart to update internal variables:

Code: Select all

TChart1.Environment.InternalRepaint
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Roger Nye
Newbie
Newbie
Posts: 10
Joined: Tue Aug 17, 2004 4:00 am

Post by Roger Nye » Thu Aug 21, 2008 8:36 am

Yes, that worked a treat.
Thanks Yeray

Best regards
Roger

Post Reply