Avg - method of object tvPoints
Returns the average value calculated from values according to the sFilter parameter. By the parameter is it possible, for example, to specify if the average value is calculated from the whole buffer or only from the visible part of the buffer.
Avg(sFilter As String) As Double
n = oPoints.Avg(sFilter)
|sFilter||(String) type of the calculation|
all - the average is calculated from all values that are in the buffer
visible - the average is calculated only from the values that are in the moment of calling in the visible part of the buffer.
The example calculates the average value, minimum, maximum, summary and number of all points of the "t1" trend in the visible part of the viewer.
var nAvg, nMin, nMax, nSum, nCount;
var oTView = pMe.Acx;
var oPoints = oTView.Trends("t1").Points;
nAvg = oPoints.Avg("visible");
nMin = oPoints.Min("visible");
nMax = oPoints.Max("visible");
nSum = oPoints.Sum("visible");
nCount = oPoints.Count("visible");