Overview
XY charts are an oft-requested feature in LabVIEW; the ability to append new data without needing the old data to redraw the curve is desirable for plotting multiple curves over time. I found the need for one in an application of mine, and based the design off of this Knowledge Base article: http://digital.ni.com/public.nsf/allkb/18B56D8556D44BF18625753D006EFF7C
Description
This VI takes a 1D array of clusters of 2 elements as an input. The first element of the cluster is taken to be X, and the second element is Y. Each element of the 1D array corresponds to one curve you wish to plot. The examples provided should demonstrate the usage.
The output can be connected directly to the XY Graph indicator from the Graphs pallette. You can set the history buffer size, clear the chart, and use the error cluster to enforce dataflow in your program. Each VI has its own pool of memory, so you can use it to create as many multi-curve XY charts as you need.
I know there are many other implementations out there, but I wanted to share mine. Constructive criticism welcome.
Steps to Implement or Execute Code
Requirements
Software
Hardware
Additional Images or Video
Example usage, from example 2.
VI Snippet
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
I didn't look at the actual code, only at the snippet, so this is based on that:
One thing that's always a concern with these things is memory management, since the array has to be contiguous in memory. Here are some options for implementing this:
I never actually checked how these different options behave.
Also, minor style point - I really don't like Insert into Array, because it tends to be ambiguous. Unless I'm inserting in the middle of an array (rare), I much prefer Build Array.