Jump to content

Plotting a main VI's graph from a sub-VI


Recommended Posts

I am trying to use a sub-VI to take in an array of data, do some manipulation/extrapolation, and plot the result in a graph inside the main VI. I wish to use a sub-VI because this is done in multiple places in the program. Simply outputting an array of values and piping them into the graph won't work because I must be able to change the name for each trace.

I have tried simply passing a reference to the graph to the sub-VI, but I've had no luck.

Any ideas?

Thanks in advance!

David

Link to comment

You should be able to change each plot's name using a property node in the main VI. IIRC, you have to set ActivePlot first and then you can adjust all of the Plot properties.

Or a short-cut (that I usually take) is to enusre the graph is a Wavefrom Data type. The name attribute can be set for the Waveform adn provided "ignore attributes" is NOT set for the graph, the names will update with the data. I use this approach when the display code has no idea what it is plotting but the source of the data does.

So with the right kind of wire it will work.

Ben

Link to comment

You should be able to change each plot's name using a property node in the main VI. IIRC, you have to set ActivePlot first and then you can adjust all of the Plot properties.

Hi asbo - very true, but the advantage in doing everything inside the VI was I knew what exactly each trace represented (for reference, this is plotting the 10 hottest thermocouples out of 40+). While I could also pipe this information out, I'll then have to include some looping in the main VI to rename all the plots. I was hoping I could just leave all that inside the sub-VI. That said, do you think there's no way to accomplish my initial goal?

If all else fails, I suppose there's no problem piping out the data array, and an array of plot titles, and handling the titling inside the main VI - I'd just like to avoid it if possible. :)

Link to comment

Hi asbo - very true, but the advantage in doing everything inside the VI was I knew what exactly each trace represented (for reference, this is plotting the 10 hottest thermocouples out of 40+). While I could also pipe this information out, I'll then have to include some looping in the main VI to rename all the plots. I was hoping I could just leave all that inside the sub-VI. That said, do you think there's no way to accomplish my initial goal?

If all else fails, I suppose there's no problem piping out the data array, and an array of plot titles, and handling the titling inside the main VI - I'd just like to avoid it if possible. :)

Do the same thing in the sub you woul din the caller but use property nodes derived from the same ref you use to plot it.

Ben

Link to comment

Do the same thing in the sub you woul din the caller but use property nodes derived from the same ref you use to plot it.

To clarify - you can right-click the graph terminal and select Create > Reference. This will let you drop a linked reference on the block diagram. Right-click that, and you can create either a control or indicator. Use those in your subVI and wire that reference into it.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.