Multiple trends can be viewed on a Trend Tool simultaneously. This functionality can allow the user to dynamically select one or more trends to view, if script is provided to do so. Several list controls could be used in this situation to display the set of values to trend, including a List Box, a set of Check Buttons, or any ActiveX list control.
The following example uses a Microsoft ListView Control (ActiveX) to take advantage of its option to show check boxes next to list items. It is assumed that the Site/Service and Facility are configured at the View level.
Using a ListView Control (ActiveX) to enable Display of Single or Multiple Trends
on the Standard Tools palette.
on the Standard Tools palette.|
'(Declarations)
'Set up trend colors Dim trendColors(3) trendColors(0) = vbRed trendColors(1) = vbBlue trendColors(2) = vbGreen
'Initialize trend series array Dim SeriesArray(3,3)
'Method to add a series to the array and trend control Sub AddTrendSeries(longPointID, axisNum, listItem, udc) SeriesArray(axisNum, 0) = listItem SeriesArray(axisNum, 1) = longPointID SeriesArray(axisNum, 2) = udc SeriesArray(axisNum, 3) = axisNum
'Update trend control With trendControl .SiteService(axisNum) = TheView.SiteService .FacilityId(axisNum) = TheView.Facility .Udc(axisNum) = udc .AutoScale(axisNum) = True .OverlayYAxis(axisNum) = False .PointIdLong(axisNum) = longPointID .XAxisLabel = "Time" .SeriesColor(axisNum) = trendColors(axisNum) .LineType = 9 "Medium Thin Solid .Restart() End With End Sub
'End of (Declarations) |
|
Sub listControl_EventInitialize() Dim This : Set This = listControl This.Checkboxes = True This.View = 3 'Report view
'Add columns This.ColumnHeaders.Add , , "Choose one or more items to trend" This.ColumnHeaders.Add , , "UDC"
'Add descriptions in first column (changes these descriptions to match your application) With This.ListItems .Add , , "Vol Gas Today" .Add , , "Vol Gas Yest" .Add , , "Gas Rate" End With
'Add UDCs in second column (change to match your application) With This .ListItems(1).SubItems(1) = "VGT" .ListItems(2).SubItems(1) = "VGY" .ListItems(3).SubItems(1) = "RGAS" End With End Sub |
|
Sub listControl_EventItemCheck(Item) Dim This : Set This = listControl If Item.Checked = True Then longPointID = TheView.Facility & "_" & Item.SubItems For i = 0 To ubound(SeriesArray) If SeriesArray(i, 0) = "" Then 'Fill in first empty spot AddTrendSeries LongPointID, i, Item, Item.SubItems(1) Exit For End If Next Else 'Remove from series array For i = 0 To ubound(SeriesArray) If SeriesArray(i, 0) = Item Then trendControl.DeleteSeries(SeriesArray(i, 3)) SeriesArray(i, 0) = "" SeriesArray(i, 1) = "" SeriesArray(i, 2) = "" SeriesArray(i, 3) = "" Exit For End If Next ReIndexSeriesArray End if End Sub |