Promotic

tvPoints - Deatiled object description

See: the tvPoints object.

The tvPoints object holds the buffer of trend data points (one data point represents the time, value and attribute of a point). If the tvTrend object is connected to a data source by calling the tvTrend.Connect method, then the buffer is filled up automatically on each moving on the time axis of the viewer or when calling the PmgTrendViewer.ReadData method.
The buffer of data points can be controlled - add, delete, overwrite data points by methods of this object. This is particularly useful if the tvTrend object is not connected to any data source (to the variable in the PmaTrendGroup object). Then it is possible, for example, by calling the AddPoints method, to fill up the buffer and it is also possible to do the filling in the onReadData event of the viewer that is triggered each time the time axis is moved/zoomed.

Example1:
Detects the points (times and values) field in the visible part of the viewer.
JavaScriptVBScriptSelect and copy to clipboard

var oTView = pMe.Items("../TrendView");
var oPoints = oTView.Trends("t1").Points;
var aValues = oPoints.GetValueArray("visible");
var aTimes = oPoints.GetTimeArray("visible");

Pm.Debug(aValues.GetItem(0));
Pm.Debug(aTimes.GetItem(0));
Pm.Debug(oPoints.Min("visible"));
Pm.Debug(oPoints.Max("visible"));
Pm.Debug(oPoints.Count("visible"));
Example2:
Let's have a tvTrend object that is not connected to data source (in the example it is the object with t1 identifier). The buffer for displaying is filled up by methods.
JavaScriptVBScriptSelect and copy to clipboard

var tNow = Pm.Time;
var oTView = pMe;
var oPoints = oTView.Trends("t1").Points;
var vTimes = Pm.Array1(tNow-3/24, tNow-2/24, tNow-1/24, tNow);
var vValues = Pm.Array1(34, 56.6, 13.3, 98);
oTView.TimeSetType = 1;
oPoints.AddPoints(vTimes, vValues, 0, 1);
oTView.Draw();
See also:
- tvTrend.Points (property)
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
© MICROSYS, spol. s r.o.