Promotic
WikipediaLinkedInYoutubeTwitterFacebook

tvTrend - Deatiled object description

See: Object tvTrend
 

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 the data source by the Connect method) or if the tvTrend object was not connected, the buffer can be filled up by calling methods of the tvPoints object.

The tvTrend object doesn't exist in the viewer by default, it is created, for example, by calling the TrendsView.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 with the 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 objects 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, that 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 was not called at all), the trend is drawn always to the existing default GraphDefault object. This default tvGraph object has always the lowest priority of them and its 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 to the data of a remote computer with the name 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) whose parameters are also set.
Dim oTrend, oGraphDef
Set oTrend = oTView.AddTrend("t1", "Temperature")
If Not oTrend Is Nothing Then
  bConnect = oTrend.Connect(2, "http://computer/trends", "group1", "a1", 0)
  oTrend.TableColumnWidth = 80 ' setting for the table mode of the viewer
  If bConnect Then
    Set oGraphDef = oTrend.GraphDefault
    '...setting for the graph mode of the viewer
    oGraphDef.Type = "Linear"
    oGraphDef.Color = "#00ff00" 'color setting by RGB String
    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
  End If
Else
  ' .. error
End If
Example2:
This global example creates a new object of the tvTrend type in the viewer, connects it by calling the Connect to the data of a remote computer with the name 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) whose parameters are also set.
Dim oTrend, oGraph, oGraphDef
Set oTrend = oTView.AddTrend("t1", "Temperature")
If Not oTrend Is Nothing Then
  bConnect = oTrend.Connect(2, "http://computer/trends", "group1", "a1", 0)
  If bConnect Then
    Set oGraphDef = oTrend.GraphDefault
    oGraphDef.Type = "Linear"
    oGraphDef.Color = "#00ff00" 'color setting by RGB String
    oGraphDef.FillType = 1
    oGraphDef.FillColor = "#008800"
    Set oGraph = oTrend.AddGraph(1, 0, "LimitVal(gt;100)")
    If Not oGraph Is Nothing Then
      '...setting for the graph mode of the viewer
      oGraph.Color = "#ff0000"
      oGraph.Type = "Linear"
      oGraph.FillType = 11
      oGraph.FillColor = "#880000"
      oGraph.FillColor2 = "#008800"
      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
    End If
  End If
Else
  ' .. error
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice