Problem plotting graph on computers other than mine
I have implemented some graphing code using a picturebox (and a few flexgrids for data storage) for a project.
I have 3 computers with VB6 installed on all of them. After compiling the program I copied just the executable to the other computers for testing, and noticed that it works on one of them completely fine but on the other one, it doesn't plot the graph (however it draws the axes). After distributing my program to a few other team members, I realise that they have the same problem.
Initially I thought that they didn't have the required dll files (for MS Chart and MS Flexgrid), but I was wrong. I read something about p-code and n-code but I am not sure what the difference is, and whether thats got anything to do with my problem
Then, since the program involved saving text to files, I thought that somehow Windows blocked that from happening (so the axes would plot but the actual points wouldn't). However, the text files were created properly and so it must have something to do with the actual plot procedure:
Private Sub command_plotnow_Click()
'This sub procedure produces a scatter plot of the original data (x,y)
Dim xaxis As Double, yaxis As Double, xsrange As Double, Ysrange As Double
Dim rx As Double, ry As Double
Dim k As Integer, l As Integer, nx As Integer, ny As Integer, nxx As Integer, nyy As Integer, r As Integer
Dim xt(1 To 500) As Double, xtt(1 To 500) As Double
Dim yt(1 To 500) As Double, ytt(1 To 500) As Double
picPlot.Cls
'Read the data from file "c:\temp1.txt" passed from form "frmData"
Open "c:\temp1.txt" For Input As #1
Input #1, xsmin, xsmax, xtick, xstick
Input #1, ysmin, ysmax, ytick, ystick
Input #1, n
For k = 1 To n
Input #1, x(k), y(k)
Next k
Close #1
'Determine axes ranges and other plot parameters
If xsmin <= 0 Then
xaxis = 0#
Else
xaxis = xsmin
End If
If ysmin <= 0 Then
yaxis = 0#
Else
yaxis = ysmin
End If
xsrange = xsmax - xaxis: Ysrange = ysmax - yaxis
rx = Abs(xsrange) / 200: ry = Abs(Ysrange) / 200
If Abs(xsrange) < Abs(Ysrange) Then
r = rx
Else
r = ry
End If
'Set scale for plot, draw axes, ticks, and sub-ticks
picPlot.Scale (xsmin - xtick, ysmax + ytick)-(xsmax + xtick, ysmin - ytick)
picPlot.Line (xaxis, ysmin)-(xaxis, ysmax)
picPlot.Line (xsmin, yaxis)-(xsmax, yaxis)
picPlot.Line (xsmax, ysmin)-(xsmax, ysmax)
picPlot.Line (xsmin, ysmax)-(xsmax, ysmax)
nx = xsrange / xtick + 1: ny = Ysrange / ytick + 1
For k = 1 To nx
xt(k) = xsmin + (k - 1) * xtick
picPlot.Line (xt(k), yaxis - ytick / 10)-(xt(k), yaxis + ytick / 10)
Next k
For k = 1 To ny
yt(k) = ysmin + (k - 1) * ytick
picPlot.Line (xaxis - xtick / 10, yt(k))-(xaxis + xtick / 10, yt(k))
Next k
nxx = xtick / xstick
For k = 1 To nx - 1
For l = 1 To nxx
xtt(l) = xt(k) + (l - 1) * xstick
picPlot.Line (xtt(l), yaxis - ytick / 20)-(xtt(l), yaxis + ytick / 20)
Next l
Next k
nyy = ytick / ystick
For k = 1 To ny - 1
For l = 1 To nyy
ytt(l) = yt(k) + (l - 1) * ystick
picPlot.Line (xaxis - xtick / 20, ytt(l))-(xaxis + xtick / 20, ytt(l))
Next l
Next k
'Print the tick values near the tick marks
For k = 1 To nx
picPlot.CurrentX = xt(k) - xtick / 10
picPlot.CurrentY = yaxis - ytick / 2.5
picPlot.Print xt(k)
Next k
For k = 1 To ny
picPlot.CurrentX = xaxis - xtick / 1.5
picPlot.CurrentY = yt(k) + ytick / 5
picPlot.Print yt(k)
Next k
'Draw circles repesenting the data points
For k = 1 To n
picPlot.Circle (x(k), y(k)), r
Next k
command_plotnow.Visible = False
picFit.Cls
End Sub
Please could someone help me out.
Thanks.
JR.