Page 1 of 1

RecalcMinMax

Posted: Mon Jul 07, 2008 8:36 am
by 10047047
Hi,

How can I calculate min and max of the data series Y values manually? The user guide says that You can call manually to RecalcMinMax method to recalculate MinValue and MaxValue. But when I call this function as below
Series->YValues->RecalcMinMax();
The C++ Builder shows that RecalcMinMax() is not a member of TChartValueList.

Thanks.

Xia

Posted: Mon Jul 07, 2008 8:46 am
by narcis
Hi Xia,

You can do this:

Code: Select all

	double min = Series1->YValues->MinValue;
	double max = Series1->YValues->MaxValue;
or this:

Code: Select all

	double min = Series1->MinYValue();
	double max = Series1->MaxYValue();

Posted: Mon Jul 07, 2008 9:14 am
by 10047047
Hi Narcis,

Thanks for your speedy reply.

I am writing a real-time program for long-term monitoring (several days or over 10 millions points). To speed up real-time plot, I have set YValues->Modified = false during monitoring, so the min and max values will not be calculated when adding new data points during real-time monitoring. When monitoring stops, I want to adjust the Y axis according to Min and Max Y Values. How can I calculate min and max values for the recorded data?

Is it worthwhile to set Modified=false during long-term real-time monitoring in order to save calculation time? If Modified=true, does it re-calculate for all recorded data points or just compare the current min and max values with the new data, when a new data is added to the series?

Thanks

Xia

Posted: Mon Jul 07, 2008 9:30 am
by narcis
Hi Xia,

Yes, you need to use Modified property as shown in the Real-time charting article here.

When Modified is set to true it recalculates ValueLists statistics considering all data points as they can have changed entirely.

Posted: Mon Jul 07, 2008 10:22 am
by 10047047
Hi Narcis,

I read the Real-time charting article and I understand that you need to set Modified to true to recalculate min and max.

However, when Modified is set to true it recalculates statis for all data points as you said. This is ok for a small amount of data or when you just load from a data array and it calculates once. But I am using for real-time plot, this means that statistics will be recalculated for all recorded data everytime when a new data point is added and it could take a considerable amout of time when a large amount of data (over several millions) has already been recorded. This is why I want to disable the internal statistics calculation by setting Modified=false during real-time plotting, and then call a function to calculate statistics for all recorded data after real-time monitoring stops. Is there a function in data series to re-calculate statistics?

I tried Series->MinYValue(). It just returns the min Y value if calculated, but not re-calculate min Y value for the data series.

Thanks

Xia

Posted: Mon Jul 07, 2008 10:31 am
by narcis
Hi Xia,

Thanks for the information.

I'm afraid this is not possible: You'll have to manually calculate min and max values as you wish.