Hi,
I'm just starting to use ZedGraph, and it has me stumped. I have a sub CreateGraph to set up the graph and to ad the first curve. All OK.
Then another sub DrawGraphs to add more curves, and there I get a run-time error (or maybe a compile time error, not sure) as noted in the source below. It says that AddCurve isn't there, but it runs fine in CreateGraph. What am I missing??
Thanks for any pointers,
Jan Didden
I'm just starting to use ZedGraph, and it has me stumped. I have a sub CreateGraph to set up the graph and to ad the first curve. All OK.
Then another sub DrawGraphs to add more curves, and there I get a run-time error (or maybe a compile time error, not sure) as noted in the source below. It says that AddCurve isn't there, but it runs fine in CreateGraph. What am I missing??
VB.NET:
Public Sub CreateGraph(ByVal zgc As ZedGraphControl)
Dim BiasGraph As GraphPane = zgc.GraphPane
' Set the titles and axis labels
BiasGraph.Title.Text = "Linear Audio Bias Sleuth"
BiasGraph.XAxis.Title.Text = "mSecs"
BiasGraph.YAxis.Title.Text = "mAmperes"
' Make up some data points from the Sine function
Dim list = New PointPairList()
Dim x As Double, y As Double
For x = 0 To 36
y = Math.Sin(x * Math.PI / 15.0)
list.Add(x, y)
Next x
' Generate a blue curve with circle symbols
Dim BiasCurve As LineItem = BiasGraph.AddCurve("Bias Current", list, Color.Blue, SymbolType.Circle)
' Make the symbols opaque by filling them with white
BiasCurve.Symbol.Fill = New Fill(Color.White)
' Fill the axis background with a color gradient
BiasGraph.Chart.Fill = New Fill(Color.White, Color.LightGoldenrodYellow, 45.0F)
' Fill the pane background with a color gradient
BiasGraph.Fill = New Fill(Color.White, Color.FromArgb(220, 220, 255), 45.0F)
' Calculate the Axis Scale Ranges
'BiasGraph.AxisChange()
zgBiasGraph.AxisChange()
zgBiasGraph.Refresh()
End Sub
Public Sub DrawGraphs(ByVal BiasGraph)
' Make up some data points from the Sine function
Dim list = New PointPairList()
Dim x As Double, y As Double
For x = 18 To 54
y = Math.Sin(x * Math.PI / 15.0)
list.Add(x, y)
Next x
'CreateGraph(BiasGraph)
' Generate a red curve with circle symbols
'The next line gives a runtime error:
'AddCurve is not a member of the ZedGraph calss or similar wording...
Dim PowerCurve As LineItem = BiasGraph.AddCurve("Output Pc", list, Color.Red, SymbolType.Circle)
' Calculate the Axis Scale Ranges
'BiasGraph.AxisChange()
zgBiasGraph.AxisChange()
zgBiasGraph.Refresh()
End Sub
Thanks for any pointers,
Jan Didden