Jump to content
Sign in to follow this  
Thang Nguyen

how to plot multiple data with correct time stamp?

Recommended Posts

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.