LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

plot data from 2 files, with different time bases to an XY graph

Every 15 minutes, for 12 weeks I store a chamber's environmental data to a database.Once a week data measurements are taken on the samples and stored (to a different table in a database) BOTH TYPES OF DATA ARE TIME-STAMPED (data and time)This gives me approximately 672 points of environmental data per week to each single test measurement and I need to plot this on a common graph.
X axis is time base, both Y axes for both data sets. If there is an example showing this I haven't found it yet. Thanks - lmd2
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 1 of 8
(3,255 Views)
If you're having problems creating an XY graph with multiple plots, the example called XY Graph should help. Basically, a single plot consists of an x array and a y array bundled together to create a cluster. A multi-plot is an array of those clusters. A 2 element build array function will do the trick.

For two separate time axes on the graph, it's easy enough to add a second X axis and associate an X axis to a set of data. First, on the graph, right click on the X axis and select Duplicate Scale. By default, this will create a new X axis called Time 2. You can right click on this new axis and select Swap Sides if you want this new axis on the top of the graph. In the Plot legend window, you should have both of your plots listed. Right click on the one y
ou want to change your X axis (i.e. Plot 1), go to X Scale and select the X axis you want (i.e. Time 2).
0 Kudos
Message 2 of 8
(3,255 Views)
I am not looking for two separate time scales. I need one time scale that covers the 12 week time frame of the test - AND I need both sets of data to be plotted at the correct time according to its time stamp; the environmental data will be just over 8K points and the test data will be 12 points INTERSPERSED CORRECTLY. I have been using LabVIEW since LabVIEW 3 back in 1995; I can manage the two Y-axis for the two data sets - I just don't know a clean way to plot 12 points of test data at the correct time stamp. If the environmental data defines 8064 points on the x-axis can a data point be INSERTED at a particular spot based time stamp, or must I construct an 8K array populated by all NaN except for the 12 valid points for the 2nd plot?
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 3 of 8
(3,255 Views)
Apologies if I'm missing something from your description, but if all data is timestamped are you looking for something like in the attached graph?
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 4 of 8
(3,255 Views)
The example posted is the way I was interpreting the situation as well. The XY graph is perfectly capable of plotting two separate sets of data of different sizes without doing anything special.
0 Kudos
Message 5 of 8
(3,255 Views)
The example is perfect, I didn't know that it was handled automatically.
I imagine I will have to change the array of Time Stamp (as strings from the DB) to Time Stamp (as DBL to bundle for the cluster input to the XY graph)
That is not a direct string to number conversion (or is it)?
Thanx for the insight
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 6 of 8
(3,255 Views)
> That is not a direct string to number conversion (or is it)?

All depends on what the time string is in your database. You may need a variation of something like the attached.
=====================================================
Fading out. " ... J. Arthur Rank on gong."
0 Kudos
Message 7 of 8
(3,255 Views)
Thanks, your method looks pretty straight forward. What I came up with is:
when I store the time stamp I use "Get Date/Time String" function with a space concatonated between the date and time: datetime
When I recall it from the DB using "SELECT tStamp from ..." the function "Database Variant To Data" used to convert it to a string, now instead I just wired a timestamp constant into the "type" input and it does the conversion for me.
Do you think either way may be more efficient?
Bottom line is that it is working!
Thanks for all your help
lmd2
Lawrence M. David Jr.
Certified LabVIEW Architect
cell: 516.819.9711
http://www.aleconsultants.com
larry@aleconsultants.com
0 Kudos
Message 8 of 8
(3,255 Views)