Example: NewData method

Example: NewData method with multiple readings
Private Sub UpdatePens2D() ' Update the pens with a 2D array. ' This example sends 100 readings to the graph at once. Dim Var As Variant ReDim vararray(1 To Trend1.Pens.Count, 100) As Variant Dim i, j As Integer For j = 1 To 100 ' Produce data for 100 points For i = 1 To Trend1.Pens.Count vararray(i, j) = i * 10 * Rnd Next i Next j ' Set the buffer to hold all the new points and a few extras. Trendx1.BufferSize = 150 Var = vararray ' Send new data to the chart. ' The first point is 100 seconds before now. ' The interval between points is 1000 milliseconds: 1 second. ' The data is in 'Var'. Trend1.NewData DateAdd("s", -100, Now), 1000, Var End Sub
Example: NewData method with one reading
Private Sub UpdatePens() Dim Var As Variant ReDim vararray(1 To Pens.Count) As Variant For i = 1 To Pens.Count ' For a real application, vararray(i) would be ' set to real data. ' For example, ' vararray(i) = txtPLCData(i).text ' where txtPLCData is an array of text fields ' being fed PLC data via DDE. vararray(i) = i * 10 * Rnd Next Var = vararray Trend1.NewData Now, Timer2.Interval, Var End Sub
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal