11-07-2009 06:09 PM
This isn't so much a question as much as a potential solution, and any comments or feedback would be appreciated.
I'm working on a VI to log and graph multiple voltages, multiple temperatures, one current measure, and one controller setpoint for a fuel cell experiment. The current and setpoint XY graphs would have one plot each, and the voltage and temperature XY graphs would potentially have several plots each.
On the current and setpoint graphs, I had already figured out how to append the latest data onto each graph's Value property as the data is acquired. But for the multiple-plot graphs, it wasn't as easy (since Value is a 1D array of clusters of paired 1D arrays, it takes a while to wrap your head around it). The VIs below should solve the problem for both the single-plot case and the multiple-plot case:
The demo's front panel, with three plots being updated once per second
The demo's block diagram
The SubVI's block diagram
11-08-2009 07:35 AM
Since you didn't ask a question, I will
Why didn't you just use the XY Chart.vi from the help?
11-08-2009 08:01 AM
Is there an XY Graph example that updates the graph as each point arrives, or do they all update the graph once at the end of the VI? My guys' application samples very slowly over a period of several days or weeks (think samples per hour instead of samples per second) and they want to see the trend of recent measurements as new measurements are added.
I did look at XY Graph to get the data structures required for a multi-plot graph, but there's a chance I've missed something more fundamental (I once spent several hours working around a theorized deficiency with running Write Measurement File inside a loop, and then when I tried it in the loop, things just worked properly). So there's always a chance I've greatly overcomplicated something -- LabVIEW isn't my main development environment, and I may working under false assumptions somewhere.
11-08-2009 09:40 AM
Look in the help for "XY Chart" instead of "XY Graph"!
It's the same control on the front panel, an XY Graph, but the code behind make it act as a chart, just what you need, add one point once in a while.
You can handle XY Graph in two ways:
In case you get all points at once: Then use a cluster of two 1D array's, 1 for X data and 1 for Y data. In case of multiple plots, just build a 1D array of clusters.
In case you get one point at the time: Then use a 1D array of clusters where each cluster contains X and Y data of one data point. In case of multiple plots, make a cluster of that 1D array and place it in a new array.
Reading your post, you have the second option but use the first data structure
11-08-2009 01:56 PM
You're correct that XY Chart, not XY Graph is much closer (nearly identical) to what I'm looking for. I'm having some trouble adapting it to accept an arbitrary number of channels for input, but I'm going to work on it for another day or two before posting again. Thanks.
11-09-2009 07:53 AM
A Waveform Datat type Chart has a lot of functionality that most people miss.
When you use a WF data type
1) the chart will plot based on the "t0" values.
2) An empty "Y" arrray will not plot.
So you may want to investigate using the WF version of the chart.
Ben