LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plotting: Different Data Types with Timestamps

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!

 

 

 

0 Kudos
Message 1 of 15
(3,367 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 15
(3,344 Views)

And in this old thread I posted an example to show the timestamps do not all have to be the same or periodic.

 

Ben

 

 

 

 

 

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 15
(3,333 Views)

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

 

 

 

 

0 Kudos
Message 4 of 15
(3,331 Views)

I faced a similar issue and finally gave in by converting everything (just prior to plotting) to DBL then messing with active plot attributes.

0 Kudos
Message 5 of 15
(3,293 Views)

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. 


GCentral
0 Kudos
Message 6 of 15
(3,250 Views)

 

 

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 15
(3,224 Views)

@Ben wrote:

 

And please do not forget to have fun!

 


Please... This is LabVIEW. How could you forget to have fun?!


GCentral
Message 8 of 15
(3,213 Views)

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[][]

 

 

0 Kudos
Message 9 of 15
(3,195 Views)

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!

0 Kudos
Message 10 of 15
(3,192 Views)