Draw graph on picture box
Hi :wave:
I need to plot a series graph ( x-axis is 'time in minute',y-axis is data) on a picture box uisng VB6.0 ( no dotNET). The data are from a data file named mydata.txt.
But I have not figure out how to do it . could somebody pls show me how?
Thanks
:wave:
Re: Draw graph on picture box
Re: Draw graph on picture box
Hi Lintz
I tried , but I need to read data from the datafile, how?
I also need a scaled x,y axis.
Thanks
Re: Draw graph on picture box
I'm not sure about the scales (but I wouldn't mind knowing myself :)) but this will open a file and plot the data.
VB Code:
Private Sub Form_Load()
Dim xPoint As Single
Dim yPoint As Single
Dim s As String
Dim PlotData() As String
Picture1.ScaleHeight = 100
Picture1.ScaleWidth = 100
FirstValue = True
Open "C:\MyData.txt" For Input As #1
Do Until EOF(1) = True
Line Input #1, s
PlotData = Split(s, ",")
Picture1.Line (xPoint, yPoint)-(PlotData(0), PlotData(1))
xPoint = PlotData(0)
yPoint = PlotData(1)
Loop
Close #1
End Sub
Re: Draw graph on picture box
Hi Lintz
Thank you very much