General Category > Support Questions

Show Historical Data with ChartBySampling

(1/1)

FuzyDragon:
Hello all,

I have a ChartBySampling up and running in my code and it works just fine with the PLC addresses I have put into it. However, whenever I close the form that has the graph in it and reopen it, the data that was previously collected was gone and it started over from scratch again. I need to keep that data in the graph because we need to see days worth of data on this graph. Is there a way to have the graph open and close while still having it record data for however long the graph is open?

MrPike:
you may want to comment out the top section of code found on the form.vb to make the code poll even when the form is closed like below.  Highlight the code and use the comment feature in the toolbar of VS or Ctr+K,Ctr+C.


    '*******************************************************************************
    '* Stop polling when the form is not visible in order to reduce communications
    ''*******************************************************************************
    'Private Sub Form_VisibleChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.VisibleChanged
    '    If components IsNot Nothing Then
    '        Dim drv As AdvancedHMIDrivers.IComComponent
    '        '*****************************
    '        '* Search for comm components
    '        '*****************************
    '        For i As Integer = 0 To components.Components.Count - 1
    '            If components.Components(i).GetType.GetInterface("AdvancedHMIDrivers.IComComponent") IsNot Nothing Then
    '                drv = components.Components.Item(i)
    '                '* Stop/Start polling based on form visibility
    '                drv.DisableSubscriptions = Not Me.Visible
    '            End If
    '        Next
    '    End If
    'End Sub

FuzyDragon:
Thanks for the quick reply. This seems like it would be easier to work with then the solution I scrounged up. I created another solution by using the following code under a FormClosing action:

If e.CloseReason = CloseReason.UserClosing Then
      e.Cancel = True
      Me.Hide()
End If

Thank you again for the quick reply.

Navigation

[0] Message Index

Go to full version