Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

CWChart freezes up when attempting to plot two dimensional array

In visual basic 6.0 I have placed a CWGraph on the form. I have set up the graph for two plots on the y axis. When I try to plot a two dimensional array (data) using the following syntax
"CWGraph1.plotY data,0,1,False", the program freezes up and I have to close VB to get things going again. I have been successful plotting a one dimensional array using "CWGraph1.PlotY data". I would appreciate any help.
0 Kudos
Message 1 of 3
(3,300 Views)
I'd have to see some code and data to see what's going on in your case. Here's a quick example that demonstrates plotting a 2D array, though. Create a new VB project and add a graph and a button to the form. Double-click on the button and add the following code:

Dim data(4, 99) As Double

Dim i As Integer
Dim j As Integer

For i = 0 To 4
For j = 0 To 99
data(i, j) = (Rnd * 10) + (10 * i)
Next
Next

CWGraph1.PlotY data

Run the project and click the button and you'll see that it's plotting the 2D array by plotting each row of the data on a separate plot. Hope this helps.

- Elton
Message 2 of 3
(3,300 Views)
Elton,
Thanks for the answer. My problem was in the details. I was dimensioning my array incorrectly. I must have overlooked that a dozen times. As soon as I saw your code, it lifted the block. Thanks again.
0 Kudos
Message 3 of 3
(3,300 Views)