VB.net graph problem - i loose the data in the graph

Status
Not open for further replies.

D_A_V_E

Member level 5
Joined
Nov 13, 2007
Messages
91
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,288
Activity points
1,736
VB.net graph problem.

Dear All,

I have written a program in vb.net for displaying some real time data in a graph. This is working just fine and there is no problem with that. But it seems that the screen is refreshed randomly and i loose the data in the graph. It goes on with writing data but the history is lost! It seems the affect also other programs which i have opened. What could be the problem?????

thank you in advance guys,

D

here is the routine
********************************************************************
Private Sub drawG1(ByVal sample As Integer)

Dim g As Graphics = Graph1.CreateGraphics
Static x As Integer
Static old_sample As Integer

If x < Graph1.Width Then
x += 1
Else
x = 0
End If

sample = (256 - sample) * Graph1.Height / 512
g.DrawLine(Pens.WhiteSmoke, x, 1, x, Graph1.Height)
g.DrawLine(Pens.WhiteSmoke, x + 1, 1, x + 1, Graph1.Height)

If x >= 1 Then
g.DrawLine(Pens.Blue, x - 1, old_sample, x, sample)
End If
old_sample = sample
End Sub
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…