Thang Nguyen Posted May 4, 2007 Report Share Posted May 4, 2007 Hi, I am working on a project, which require plotting and logging data with different frequency. The issue is I don't know how to plot the data with the correspondent timestamp. I tried with waveform chart, but it only receive the value input, not time. We can set X offset, but the time will increase constantly, we can not change it. Please give me some advice how to plot multiple data with the time stamp. Thank you, Thang Nguyen Quote Link to comment
Yair Posted May 5, 2007 Report Share Posted May 5, 2007 You need to use the XY graph, which accepts an array of all the data to plot, including X values. There are several examples in the example finder (search for "graph") including one which shows how to simulate a chart using a graph. Quote Link to comment
Thang Nguyen Posted May 5, 2007 Author Report Share Posted May 5, 2007 QUOTE(yen @ May 3 2007, 06:18 PM) You need to use the XY graph, which accepts an array of all the data to plot, including X values.There are several examples in the example finder (search for "graph") including one which shows how to simulate a chart using a graph. I see that they put everything in the buffer then plot it out. Is there any better way? I need to update the plot at every value. Thank you for your answer anyway, Thang Nguyen Quote Link to comment
Neville D Posted May 5, 2007 Report Share Posted May 5, 2007 QUOTE(Thang Nguyen @ May 4 2007, 07:43 AM) I see that they put everything in the buffer then plot it out. We can use an array and append a new value into this array and plot it out at each interval. If I do a test for three days. This will become a big problem with memory for a multiple plot. Is there any better way?I also need to update the plot at every value with dynamic interval. Thank you for your answer anyway, Thang Nguyen If you do a test "for 3 days" do you have to see every single pt of data you have got? You need to think about the resolution of your monitor wrt to the number of points you are trying to view. Or maybe resample your data points so that the dt is the same for all plots and then just use a chart. There is an express VI to resample data. Extract out the necessary VI's from it for your use. Or else, some form of intelligent data decimation is required. There is an article on the NI site on data decimation for display. Neville. Quote Link to comment
Michael Aivaliotis Posted May 5, 2007 Report Share Posted May 5, 2007 QUOTE(Thang Nguyen @ May 4 2007, 07:43 AM) I see that they put everything in the buffer then plot it out. We can use an array and append a new value into this array and plot it out at each interval. If I do a test for three days. This will become a big problem with memory for a multiple plot. Is there any better way? You can modify the array so that you only view the last n points. Once it reaches a certain size (which you determine) delete one old data point from the array before adding a new one. Quote Link to comment
Thang Nguyen Posted May 5, 2007 Author Report Share Posted May 5, 2007 QUOTE(Michael_Aivaliotis @ May 4 2007, 11:58 AM) You can modify the array so that you only view the last n points. Once it reaches a certain size (which you determine) delete one old data point from the array before adding a new one. Thanks, I am working with this solution Quote Link to comment
Yair Posted May 6, 2007 Report Share Posted May 6, 2007 The error is probably caused because the reference you created does not match the data type you are actually wiring into the control (a graph with multiple plots is different than a graph with a single plot). You should basically create a reference of your final graph and put that in the cluster. In any case, this method is bad because it might create a copy of the data and it would force the display to update. Instead, you should do something like the example here. In general, the right way to handle this would depend on the typical way in which you get data and what you need to do with it, but unless you have very large amounts of data, you should be fine. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 7, 2007 Report Share Posted May 7, 2007 QUOTE(Thang Nguyen @ May 3 2007, 06:32 PM) Hi,I am working on a project, which require plotting and logging data with different frequency. The issue is I don't know how to plot the data with the correspondent timestamp. I tried with waveform chart, but it only receive the value input, not time. We can set X offset, but the time will increase constantly, we can not change it. Please give me some advice how to plot multiple data with the time stamp. Thank you, Thang Nguyen A waveform datatype Chart (LV 6.0 and above) will allow muiltiple plots with non-periodic time stamps and a different number of samples for each plot. The "t0" value of the waveform will define the "x" value. Note: If you present an update to the chart tha contains a "to" that is earlier that data already plotted, the chart will reset. http://forums.lavag.org/index.php?act=attach&type=post&id=5742''>http://forums.lavag.org/index.php?act=attach&type=post&id=5742'>http://forums.lavag.org/index.php?act=attach&type=post&id=5742 Ben Quote Link to comment
Thang Nguyen Posted May 8, 2007 Author Report Share Posted May 8, 2007 Thank for your help, The problem is I can only plot through the reference. And I think I have to use the property value. I change to waveform chart already, but the value on the plot is 0. I don't know why. Quote Link to comment
Yair Posted May 8, 2007 Report Share Posted May 8, 2007 QUOTE(Thang Nguyen @ May 7 2007, 06:21 PM) The problem is I can only plot through the reference. Why? Using the method shown by Ben or linked to in my example is usually much better than using the reference and the value property. I suggest you try it first. If you still can't get it, you should post your code so that we can see what you are actually doing. Quote Link to comment
Thang Nguyen Posted May 8, 2007 Author Report Share Posted May 8, 2007 Hi, Finally it runs. Thank Ami. The problem is in the type of waveform chart. Could anyone tell me how to make the first waveform chart, but not the second one? When first creating the waveform, it will be the third one. That why there is an issue with data type. I didn't recognize it. Quote Link to comment
Yair Posted May 9, 2007 Report Share Posted May 9, 2007 The one in the right is the default one, which accepts a single double. The other two seem to accept the waveform datatype, which I have no experience with, so I can't comment on those. As I said, my personal preference is the XY Graph. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.