1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' Make sure that the curvelist has at least one curve
'If zg1.GraphPane.CurveList.Count <= 0 Then Return
' Get the first CurveItem in the graph
Dim curve As LineItem = zg1.GraphPane.CurveList(0)
' If curve Is Nothing Then Return
' Get the PointPairList
Dim list As IPointListEdit = curve.Points
' If this is null, it means the reference at curve.Points does not
' support IPointListEdit, so we won't be able to modify it
' If list Is Nothing Then Return
Dim time As Double = (Environment.TickCount - tickStart) / 1000.0
cmd_ecg.CommandText = "select * from ecg"
Try
cn.Open()
Dim myReader As SqlDataReader = cmd_ecg.ExecuteReader()
'le SqlDataReader initialisé dans module1 permet de lire les data dans la BDD
'Tant qu'il y a des "ligne" dans la BDD
If myReader.HasRows Then
Do While (myReader.Read())
'c'est ce qui définit notre abscisse et notre ordonnée
list.Add(myReader.GetValue(1), myReader.GetValue(0))
Loop
End If
myReader.Close()
cn.Close()
Catch ex As Exception
End Try
' Keep the X scale at a rolling 5 second interval, with one
' major step between the max X value and the end of the axis
Dim xScale As Scale = zg1.GraphPane.XAxis.Scale
If time > xScale.Max - xScale.MajorStep Then
xScale.Max = 0.5 * time + xScale.MajorStep
xScale.Min = xScale.Max - 3
End If
zg1.AxisChange()
' Force a redraw
zg1.Invalidate()
End Sub |
Partager