How to make vertical axis fit only for visible points?

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SSWang
Newbie
Newbie
Posts: 10
Joined: Mon Mar 14, 2011 12:00 am

How to make vertical axis fit only for visible points?

Post by SSWang » Fri Jan 13, 2012 9:31 am

Dear Steema Support,

I'd like to have the max/min range of vertical axis fit only for "visible points" whenever I change the bottom axis' min/max value programmatically. How can I do that? Currently the automatic property of an axis is taking all points in a series into account, not just visible ones. Thanks.

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

Re: How to make vertical axis fit only for visible points?

Post by Yeray » Fri Jan 13, 2012 4:25 pm

Hi,

You have to loop into the visible points (from FirstDisplayedIndex to LastDisplayedIndex) looking for the minimum and maximum YValue in the range and call the left axis SetMinMax function with these values.
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

SSWang
Newbie
Newbie
Posts: 10
Joined: Mon Mar 14, 2011 12:00 am

Re: How to make vertical axis fit only for visible points?

Post by SSWang » Mon Jan 16, 2012 3:20 am

Is there a way to know whether the bottom axis boundary(visible area) is changed, or one of the visible Y values is changed so that I can recaculate the vertical axis' visible min/max, just like what TChartAxis.Automatic does? I can catch the TChartSeries.OnAfterAdd, OnClearValues events but there is no "on data change" event.

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

Re: How to make vertical axis fit only for visible points?

Post by Yeray » Mon Jan 16, 2012 8:59 am

Hi,

I'm afraid there is no "on data change" event but you probably know when the data can be changed, isn't it? I mean, you probably have a routine that does it or a button to show the values in an editable grid,... so you should be able to adjust the axes after this routine/button is executed.
If it's a routine/function who changes the values, and if this routine is executed very frequently, looping through all the visible values to check if the axes need to be adjusted may be inefficient. But in this case, you probably have control to the routine and you know when exactly a value is changed and so when the axis adjustment should be done.
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

Post Reply