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
|
Imports ZedGraph
Public Class FormZedGraph
' Dim X, Y As Double
Public myPane As New GraphPane
Public list = New PointPairList()
Dim x As Double = 0
Dim y As Double = 0
Private Sub Setsize()
zg1.Location = New Point(10, 10)
zg1.Size = New Size(ClientRectangle.Width - 20, ClientRectangle.Height - 20)
End Sub
Private Sub ZedGraph_Resize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Resize
Setsize()
End Sub
Private Sub CreateGraph(ByVal x As Double, ByVal y As Double)
myPane.XAxis.Title.Text = "X Value"
myPane.YAxis.Title.Text = "My Y Axis"
For x = 0 To 36
Math.Sin(x * Math.PI / 15)
list.Add(x, y)
Next x
Dim myCuvre As LineItem = myPane.AddCurve("My cuvre", list, Color.Blue, SymbolType.Circle)
myCuvre.Line.Fill = New Fill(Color.White, Color.Red, 45.0F)
zg1.AxisChange()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
x = x + 1
y = y + 1
myPane = zg1.GraphPane
list.add(x, y)
Dim myCuvre As LineItem = myPane.AddCurve("My cuvre", list, Color.Blue, SymbolType.Circle)
zg1.AxisChange()
End Sub
End Class |
Partager