03-17-2017 01:51 PM
Hi Everyone,
I have a dataset of different datatypes, with time stamps. Each time stamp has only one value for a single data type.
**See attached picture. I wish to plot these on top of each-other, each datatype in a different plot color.
I have attempted various ways by searching the forums, and I have found a couple posts which are similar, but I am always having trouble getting my bundles to work right, I am advanced with LV, but I am a novice with bundles, it seems to always want to force to be a string output, which is not what I desire.
I wish to see the effects one one datatype on another by plotting them together, but the key is not each timestamp has data for all types, the attached picture makes it pretty clear.
Is this possible in LV? I prefer not to artificially pad zeros as this will cause confusion in analyzing effect.
Thanks Everyone!
03-17-2017 02:41 PM
See this nugget written by Tim teaching us how to use a Waveform data type in a chart. The Waveform data type includes a time stamp and when presented to a chart, the "t0" will be used to plot the data.
I have been using that since LV 6i and it works great for situations where the data collected is not all coming it at the same time/rate etc.
Ben
03-17-2017 02:57 PM
And in this old thread I posted an example to show the timestamps do not all have to be the same or periodic.
Ben
03-17-2017 03:05 PM - edited 03-17-2017 03:30 PM
Hi Ben,
Thanks for sharing this. This is great. This is the first step, using a single plot, which I already have, but I do it in a different way, found by searching around the forums. This post you sent though is more primitive and a nice learning example.
I have attached 3 pictures:
(1) My GUI of a single datatype plotted vs. timestamp
(2) Method of obtaining the plot (small piece)
(3) My end-goal, Overlaying different datatypes on the same graph. I several plots of (1), and I wish to combined them. But the issue is each datapoint has a different timestamp. See original post pic, where data is missing in some areas. I do not wish to pad zeros as this would corrupt the results.
What I am actually doing:
I am plotting a system's log messages, each log message contains different data at different times, which you can see them in pic(2) at the bottom. Each log is of different datatype, and a different timestamp. I wish to plot all of the together with a different color for each type.
Hopefully I am not too confusing, this is hard, I don't know how to even do this in excel haha.
I found this post, which is sort of right, but now imagine only a single datatype for each timestamp. What I am REALLY trying to do is OVERLAY multiple plots and using color to make them distinguishable.
Thanks Ben (& all)
-Peter
03-17-2017 07:08 PM
I faced a similar issue and finally gave in by converting everything (just prior to plotting) to DBL then messing with active plot attributes.
03-18-2017 08:35 PM
It isn't entirely obvious from your example data and the graph attached if this would be ok for you, but you could consider padding your values with NaN values instead of zeros.
This will break your line but doesn't plot a point for that timestamp. If your data doesn't have too many missing points this might be/look ok - the graph seemed very densely populated and a missing line element probably wouldn't appear noticeable.
03-20-2017 08:01 AM
That can be done using the Waveform Data type!
I offered two links that show the basic idea.
Combined with "plot style", using an empty array if you do not have updates for a selected time period, and using "NaN" to control where plots start and end... the Waveform Data type chart/graph is fully capable of meeting your needs.
Give it a whirl and ask further if you get stuck.
And please do not forget to have fun!
Ben
03-20-2017 10:11 AM
@Ben wrote:
And please do not forget to have fun!
Please... This is LabVIEW. How could you forget to have fun?!
03-20-2017 01:54 PM
Hi cbutcher,
This is a great idea, thanks. I have seen NaN(NIL/NULL): populated in front-panel, but I am not sure how to populate NaNs in a 2D Array. I see there is a method to check for NaNa in the compare palette, but to assign an NaN, not sure.
Maybe I am wrong, all software environments are different, but if you have a 2D Array, and throw down a number, it will pad zeros, not NaNs, see attached quick-try, I only place the '4' in the const int array[][]
03-20-2017 01:56 PM
Hi Ben,
Also need to preserve the Timestamp, not a sample number. So X-axis can be a TimeStamp data type?
Thanks for the help Ben!