08-04-2010 09:48 AM
Maybe It's a stupid, but I don'k know how to solve it.
Suppose you have a while loop and you have double data type, for example a random number. Then you send the data to a waveform chart. But in the x-axis you want the time in the proper format: month, year, day, hour, seconds, minutes, etc.
Choosing from the properties of the chart the "absolute time", makes the x axis start in the 1904.
Then I tried to create a property node in order to modify the Xscale offset, giving as a offset the timestamp from Get Date and converting it in a double. The first data has correct value for x-axis, but then the x-axis increases at a wrong rate (much faster than the real time). I tried to put the property node inside or outside the property node.
I tried also to play with other property nodes (Minimum and Maximum). I used a flat sequence structure inside the while in order to call the date before the chart, but I had no success.
My question is: is there a way to have the proper value of time with a waveform chart if the data is a double?
[I don't want to use the XYGraph instead of waveform chart, because I need all the benefits given by the waveform chart that the graph has not.]
Thank you in advance
Solved! Go to Solution.
08-04-2010 09:51 AM
Have you considered looking at the examples that come with LabVIEW? Do a search for chart. Open the VI called Real Time Chart.
08-04-2010 10:09 AM
The code I posted in this thread will let you plot data based on the time of the measurement. It uses a waveform data type to let you specify the "t0".
It looks like this.
have fun,
Ben
08-04-2010 12:03 PM
That's exactly what I wanted! Great! Sorry if I could not find your old post: when I made a search I missed it. Thank you very much.
08-04-2010 12:20 PM
From what I see, you will still have the problem of an incorrect dt unless your sample rate is 1 second.
08-04-2010 12:37 PM
@Dennis Knutson wrote:
From what I see, you will still have the problem of an incorrect dt unless your sample rate is 1 second.
Good point Dennis!
From my experiements I believe as long as
1) There is only a single element in the "Y" array, the dt appears to have no effect provided...
2) The next update to the plot has a t0 that is larger than the previous time plus the default "dt"
so if the update come more often than the default of dt=1 second and all of the new time stamps are ever increasing it should work fine.
In apps where I use this technique I usally set the dt to be very small and not cause problems.
The tell-tale sign that the dt is to small is the chart will suddenly clear itself.
This techniques has worked very well for those apps where I am talking to a widget that is not periodic but I need to plot the updates vs time.
And if you really push it....
You can have data coming in at dirrenet times for each channel and as long as the "Y" array is empty the chart will ignore those plots. You can see sign of that in the above image where one plot is ahead of the other.
Ben
08-04-2010 12:46 PM
Cool. Never really used a waveform data type with a single element before with a chart. Learned something new today. Thanks!