Avg - method of the tvPoints object
Description:
Returns the average value calculated from values according to the sFilter parameter.
Syntax:
Double Avg(String sFilter)
Parameters:
sFilter | (String) Filter of values that are to be included into the processing.
"all" - All values in the buffer.
"visible" - All values that are in the time of calling the method in the visible part of the buffer. |
---|
Example:
The example calculates the average value, minimum, maximum, sum and number of all points of the "t1" trend in the visible part of the viewer.
JavaScriptVBScriptSelect and copy to clipboard
var nAvg, nMin, nMax, nSum, nCount;
var oTView = pMe;
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");
Dim nAvg, nMin, nMax, nSum, nCount, oTView, oPoints
Set oTView = pMe
Set 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")