ZedGraph图像实时更新问题,高手请进!
各位大侠,小弟有个问题请教:
我Z最近做图表统计模块时,按网上推荐用了ZedGraph控件,用起来确实简单,但也出现了一个问题,就是我用数据源DataTable做数据坐标时,第一次查询时显示一个图标统计图像,再查询时(第二次查询所得到的数据比第一次少时)则显示的图像中第一次查询得到的坐标点在图像上仍然存在仍然存在,在网上查了好多,好多文章都只是简单的入门使用介绍。这样的问题都没有提到,所以只好向高手们求救了啊!
附代码与图片:
Public Sub CreateImg(ByVal ZGC As ZedGraphControl)
Dim MyPane As GraphPane = ZGC.GraphPane
' MyPane.XAxis.Scale.MaxAuto = True
MyPane.Title.Text = "Trend Chart"
MyPane.XAxis.Title.Text = "Parameter"
MyPane.YAxis.Title.Text = "Result"
MyPane.Legend.IsVisible = True
Dim ListIth As PointPairList = New PointPairList
Dim ListSE As PointPairList = New PointPairList
Dim ListImPop As New PointPairList
Dim ListVbr As New PointPairList
Dim ListIdark As New PointPairList
Dim ListSen As New PointPairList
Dim Table As DataTable = C.GetDataSource("select Ith ,SE,Im_Pop,Vbr,Idark,Sen ProductDate from TrendChart where ProductDate between '" & Me.DateTimePicker1.Value & "' and '" & Me.DateTimePicker2.Value & "'")
' ListIth.Clear()
' ListSE.Clear()
' ListImPop.Clear()
If Table.Rows.Count > 0 Then
For i As Integer = 0 To Table.Rows.Count - 1
ListIth.Add(CDbl(i), CDbl(Table.Rows(i)(0)))
ListSE.Add(CDbl(i), CDbl(Table.Rows(i)(1)))
ListImPop.Add(CDbl(i), CDbl(Table.Rows(i)(2)))
ListVbr.Add(CDbl(i), CDbl(Table.Rows(i)(3)))
ListIdark.Add(CDbl(i), CDbl(Table.Rows(i)(4)))
ListSen.Add(CDbl(i), CDbl(Table.Rows(i)(5)))
Next
End If
Dim MyCurveIth As LineItem = MyPane.AddCurve("Ith", ListIth, Color.Blue, SymbolType.Circle)
Dim MyCurveSE As LineItem = MyPane.AddCurve("SE", ListSE, Color.Red, SymbolType.Square)
Dim MyCurveImpop As LineItem = MyPane.AddCurve("ImPop", ListImPop, Color.Green, SymbolType.Star)
Dim MyCurveVbr As LineItem = MyPane.AddCurve("Vbr", ListVbr, Color.SteelBlue, SymbolType.Triangle)
Dim MycurveIdark As LineItem = MyPane.AddCurve("Idark", ListIdark, Color.Navy, SymbolType.VDash)
Dim MycurveSen As LineItem = MyPane.AddCurve("Sen", ListSen, Color.DarkCyan, SymbolType.TriangleDown)
MyPane.AxisChange(Graphics.FromImage(MyPane.GetImage))
'Dim FilePath As String = "E:\123.bmp"
'ZGC.SaveAs(FilePath)
'ZGC.AxisChange()
ZGC.Refresh()
End Sub
第一次查询的图片:
第二次查询的图片:
------解决方案--------------------我来了,结贴吧
------解决方案--------------------楼主,我也在做这方面的,外文网址是什么啊,我先收藏了