02-14-2011 12:43 PM
In order to get what you are looking for you need to be appending the elements to the array, and using PlotXYMultiple. In order to get the points to display instead of the lines you will need to change the properties of the graph. Below is an example of the general idea.
Dim numOfPoints = 10 Dim numOfPlots = 2 Dim xData(numOfPoints) As Double Dim yData(numOfPlots, numOfPoints) As Double For i = 1 To numOfPoints xData(i) = i For j = 1 To numOfPlots yData(j, i) = j + i ScatterGraph1.PlotXYMultiple(xData, yData) pause() Next Next
02-14-2011 01:16 PM
That still doesn't answer my initial question. How do I plot the data points (received once or twice a minute, for two straight days), so that the graph is updated when the datas are received instead of waiting for the test to complete. I thought the "ScatterGraph1.PlotXYAppend (x, y) would do the trick. However that didn't work. An option I have is to allocate enough memory to save all the data points and then plot after each iteration run. But that would defeat the whole exercise that I'm doing, especially if I want to simplify my code and reduce the need for unnecessary memory resource.
02-14-2011 01:16 PM
That still doesn't answer my initial question. How do I plot the data points (received once or twice a minute, for two straight days), so that the graph is updated when the datas are received instead of waiting for the test to complete. I thought the "ScatterGraph1.PlotXYAppend (x, y) would do the trick. However that didn't work. An option I have is to allocate enough memory to save all the data points and then plot after each iteration run. But that would defeat the whole exercise that I'm doing, especially if I want to simplify my code and reduce the need for unnecessary memory resource.
02-14-2011 01:24 PM
Sorry I may not have been clear enough, but the code I sent was meant to demonstrate that functionality. Imagine each iteration of the loop is when you get a new data point. You will need to add the new data point to the end of the array that contains the data from all of the previous information, and then plot that new array. So you can create an array with enough space to hold all of the data throughout the entire run of your project, or make a new array that is one element larger than the last one each time you get a new peice of data, and copy all of the data from the first array, and then add your new data point to the end of the array. Essentially, you take care of storing the data in the array, and then update the display by ploting the new array each time something changes.
02-14-2011 03:03 PM
To address the append function, I have done some testing and it seems that the append plot appends a new plots, not a point to the current plots. That is why the graph looks like it does. I don't think you should have problems storing that much data, but if it becomes to larger to handle you could always write the data to a log file as they are aquired, and then plot the last 1000 entries in the file or something like that so the majority of the data is in non volitile memory, and you can see what is happening in the plot for a smaller window of history. If the data is only updating every minute or so reading from file everytime you wanted to plot has no real time constraints so it seem s like a viable options. Then you could run for extremely long periods of time.