Real-Time Data Plot in VB 2008

CycloWizard

Lifer
Sep 10, 2001
12,348
1
81
I'm writing a data acquisition program in VB 2008 Express. The program essentially sends commands to a controller and the controller runs internal programs and throws a lot of data back at my computer. I would like to sample this data every 100 ms or so and put it in a plot so I can follow the data more easily, since I'm monitoring 16 variables at a time.

In its current form, I'm doing this by simply updating a progress bar based on the value of the variables. This doesn't give me any history of the variable, however, which would be really helpful for my application. It looks like all of the VB plotting tools from VB6 no longer work, so I was wondering if anyone had any suggestions/ideas. Current code is basically the following:

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Try
ProgressBar1.Value = Data1
ProgressBar2.Value = Data2
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

where the timer executes at a user-specified interval (e.g. 100 ms) and "Data1" and "Data2" are the data of interest.
 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
Did you check CodeProject.com for a VB.Net plotting library?

For a graph plot you'd want to have set up array of N values (blank at first), then once it's full you shift left 1 to make room for the newest value.


 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
GDI+, perhaps? Get a reference to the graphics object of the relevant form from the onpaint event, store it and use that for some graphing?
 

CycloWizard

Lifer
Sep 10, 2001
12,348
1
81
Thanks guys, I think I found something at CodeProject that might work. I've been doing MATLAB so long that I forgot that not every package has built-in graphing. :p