Search This Blog

Monday, June 29, 2009

Zedgraph a simple example, code

Zedgraph a simple example, code
VB.net code
===========CODE==============
Dim myPane As GraphPane
myPane = ZedGraphControlA.GraphPane
'title
myPane.Title="GRAPH"
myPane.YAxis.Title.Text = "Y"
myPane.XAxis.Title.Text = "X"
'set scale
myPane.XAxis.Scale.Max = 10
myPane.XAxis.Scale.Min = -10
myPane.YAxis.Scale.Max = 10
myPane.YAxis.Scale.Min = -10


'create a list
Dim list1 As New PointPairList
Dim i as integer

For i = 0 To 1
x = 0
y1 = 0
list1.Add(x, y1)
next i

'add a curve
myCurveA = myPane.AddCurve("", list1,color.blue, SymbolType.None)

'points to add
pts= myCurveA.Points

pts.Clear()

'add points
pts.Add(3,3)
pts.Add(4,4)
pts.Add(5,5)
pts.Add(6,6)

myPane.AxisChange()
' Make sure the Graph gets redrawn
ZedGraphControl1.Invalidate()

No comments:

Post a Comment