Promotic

tvTrend - Deatiled object description

See: the tvTrend object.

The object of the tvTrend type represents a trend of one variable. The trend is saved as a set of data points in the subobject of the tvPoints type. The buffer of the tvPoints object is filled up either automatically on any change of the time axis time (if the tvTrend object was connected to data source by the Connect method) or if the tvTrend object was not connected, then the buffer can be filled up by calling the methods of the tvPoints object.
The tvTrend object does not exist in the viewer by default, it is created, for example, by calling the PmgTrendViewer.AddTrend method. Each tvTrend object is uniquely identified by its ID identifier.

The trend of one variable of the tvTrend object can be drawn by more objects of the tvGraph type. Repeated calling the AddGraph method creates a container of tvGraph objects. On drawing the set of trend data points is evaluated by individual objects of the tvGraph type by the validity function. Exactly that of the tvGraph object whose validity function is fulfilled, is used for drawing. The validity function, for example, says it is drawn by this graph if values of trend points exceed the value 100. Then in the time area where values of trend points exceed the value 100, just this tvGraph object is used for drawing. If there are more objects with fulfilled validity function, then one of them with the highest priority is used (the first added graph by the AddGraph(...) has the highest priority, lastly added one has the lowest priority).
This algorithm is used for drawing in both the graph and table mode.
If no tvGraph object was added (the tvTrend.AddGraph method was not called at all), then the trend is drawn always to the existing default GraphDefault object. This default tvGraph object has always the lowest priority of them and its validity function is always fulfilled.

Example1:
This global example creates a new object of the tvTrend type in the viewer, connects it by calling the Connect method to the data of a remote computer named "computer", respectively to the a1 variable of the group1 group in the trends server on this computer computer. The trend is drawn by the pre-constructed object of the tvGraph type (see the oGraphDef variable) whose parameters are also set.
JavaScriptVBScriptSelect and copy to clipboard

var bConnect, oGraphDef;
var oTView = pMe.Items("../TrendView");
var oTrend = oTView.AddTrend("t1", "Temperature");

if (oTrend)
{
bConnect = oTrend.Connect(2, "http://computer/trends", "group1", "a1", 0);
oTrend.TableColumnWidth = 80;   // Setting for the table mode of the viewer
if (bConnect)
{
oGraphDef = oTrend.GraphDefault;
// ...Setting for the graphic mode of the viewer
oGraphDef.Type = "Linear";
oGraphDef.Color = "#00ff00";   // color setting by RGB String in the form "#RRGGBB"
oGraphDef.FillType = 1;
oGraphDef.FillColor = "#008800";
oGraphDef.PointsVisible = true;
oGraphDef.PointsType = 3;
oGraphDef.PointsSize = 8;
oGraphDef.PointsColor = "#000000";
// ...Setting for the table mode of the viewer
oGraphDef.TableBgColor = "#aaaaaa";
oGraphDef.TableTextColor = "#00ff00";
oGraphDef.TableFont.Size = 11;
}
else
{
// ... error
}
}
Example2:
This global example creates a new object of the tvTrend type in the viewer, connects it by calling the Connect method to the data of a remote computer named "computer", respectively to the a1 variable of the group1 group in the trends server on this computer computer. Further it sets parameters for drawing and creates (and sets parameters) a new object of the tvGraph type for drawing time areas of the trend when values exceed the constant 100. In the other time areas it is drawn by the pre-constructed object of the tvGraph type (see the oGraphDef variable) whose parameters are also set.
JavaScriptVBScriptSelect and copy to clipboard

var bConnect, oGraphDef, oGraph;
var oTView = pMe.Items("../TrendView");
var oTrend = oTView.AddTrend("t1", "Temperature");

if (oTrend)
{
bConnect = oTrend.Connect(2, "http://computer/trends", "group1", "a1", 0);
if (bConnect)
{
oGraphDef = oTrend.GraphDefault;
oGraphDef.Type = "Linear";
oGraphDef.Color = "#00ff00";   // color setting by RGB String in the form "#RRGGBB"
oGraphDef.FillType = 1;
oGraphDef.FillColor = "#008800";

oGraph = oTrend.AddGraph(1, 0, "LimitVal(gt;100)");
if (oGraph)
{
// ...Setting for the graphic mode of the viewer
oGraph.Type = "Linear";
oGraph.Color = "#ff0000";
oGraph.FillType = 11;
oGraph.FillColor = "#880000";
oGraph.PointsVisible = true;
oGraph.PointsType = 3;
oGraph.PointsSize = 8;
oGraph.PointsColor = "#000000";
// ...Setting for the table mode of the viewer
oGraph.TableBgColor = "#666666";
oGraph.TableTextColor = "#ff0000";
oGraph.TableFont.Bold = true;
}
else
{
// ... error
}
}
else
{
// ... error
}
}
PROMOTIC 9.0.27 SCADA system documentation MICROSYS, spol. s r.o.

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