08-13-2025 03:09 AM
Hi,
I want to plot something in a chart. But I want to place the chart in a main VI and pass in its reference to a subVI and do the plotting in the subVI with its reference and a property node. I dont know whether this is possible and if it is possible, I am not sure which property to use. I tried value and it didnt work. The input is a 2d array. Kindly let me know if this is possible and if yes which property. Thank you.
08-13-2025 04:00 AM
Hi govindsankar,
@govindsankar wrote:
I want to plot something in a chart. But I want to place the chart in a main VI and pass in its reference to a subVI and do the plotting in the subVI with its reference and a property node. I dont know whether this is possible and if it is possible,
Yes, it's possible.
(I would NOT recommend it…)
@govindsankar wrote:
I am not sure which property to use. I tried value and it didnt work. The input is a 2d array.
When you want to change the value of an indicator then you need to use its "value" property.
Why/how "didn't it work"?
08-13-2025 07:52 AM - edited 08-13-2025 12:36 PM
Charts accept a large variety of datatypes (scalar, clusters, 1D array, 2D array, dynamic, waveform, etc.) and the terminal adapts based on what you wire to it.
A value reference will NOT adapt to the wired datatype, so for the property node to accept a 2D array, you should wire a 2D array to the actual terminal first, at least temporarily.
I agree with Gerd that this is somewhat ugly in general. Maybe you can find a better solution.
08-13-2025 11:24 AM
I'll go against the grain here and say this does in fact work, and quite well. (Though I would discourage using Charts and use a Graph instead.)
altenbach is right though- since charts (and graphs) can accept different types as inputs, they have to dynamically change their "type" when you wire up data to them. By default, a waveform graph accepts a 1D array to plot a 1D array of data. But if you want to plot multiple things, you can wire up an array of clusters, each of which has its own 1D array of data, and the terminal will change to accept it.
The issue you're seeing is that while the terminal can do this, the Value property node cannot auto adapt. You must force the adaption using the terminal, then the Value property node will change type as well.
Demo video- the graph defaults to 1D array, and the Value node matches, until you wire up another type to the terminal:
I use this technique frequently in my Actor Framework applications for my "Display" actors. Messages processed in AF are processed as Object methods, so they don't have access to the actual front panel terminal. There are two ways then to get data onto the front panel from within the methods. The first is to stick FP references in the object's private data, then any internal methods can write to them directly. The second is to add another messaging chain (probably a user event) to send data from methods back to a helper loop on the front panel. This is more "pure" but that's a lot of boilerplate code you have to write an maintain.
If you're CONSTANTLY writing to these plots to the point that property nodes may be an issue, I'd use the second method. But if you just update a half dozen indicators once every minute or so, then the overhead of a property node is negligible.
All that said.... the OP said he wanted to write to a chart, which generally is written to fairly frequently. Once a second? You're fine. 100 times a second? Maybe put a message receiving loop on your front panel and pipe the data from your subVI through a user event/queue/etc and let the terminal do the work.
08-13-2025 12:40 PM
To be more specific, a the default value for a chart is a scalar DBL. For anything else, you need to define the desired datatype by wiring the desired structure to the terminal, at least temporarily.
08-15-2025 08:33 AM
Colleagues --
Even Old Dogs can learn New Tricks (or at least get "clued" on why their code is being so stubborn). I am currently struggling with plotting data on Waveform Graphs and having it be very stubborn (and buggy).
I don't do plotting that often, and it's usually Waveform Charts with fairly slow data rates (< 1 kHz). I almost always use Graph (or Chart) References, and often have two plots going at the same time (for instance, "Flow" and "Temperature" measurements.
My current project involves algorithms for analyzing "Learning" in a behavioral test situation. The problem was I had 5 quantities to plot on two separate Graphs: one point plot for "Sucess" trials (a symbol plotted at the top of the Graph), another point plot for "Failure" trials (plotted at the bottom of the Graph), and three "Certainty" plots (how "certain" can you say the Task has been learned as a function of Trial #).
The discussion of whether or not to use Graph References was illuminating. I didn't understand why my "Value" input (which I thought of as 1D Arrays) seemed to require 2D Arrays. [I think Altenbach may have explained this ...].
Bob Schor