Page 1 of 1
How to make vertical axis fit only for visible points?
Posted: Fri Jan 13, 2012 9:31 am
by 16558750
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.
Re: How to make vertical axis fit only for visible points?
Posted: Fri Jan 13, 2012 4:25 pm
by yeray
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.
Re: How to make vertical axis fit only for visible points?
Posted: Mon Jan 16, 2012 3:20 am
by 16558750
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.
Re: How to make vertical axis fit only for visible points?
Posted: Mon Jan 16, 2012 8:59 am
by yeray
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.