orangefob7 Posted November 24, 2010 Report Share Posted November 24, 2010 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 Quote Link to comment
asbo Posted November 24, 2010 Report Share Posted November 24, 2010 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. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted November 24, 2010 Report Share Posted November 24, 2010 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 Quote Link to comment
orangefob7 Posted November 24, 2010 Author Report Share Posted November 24, 2010 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. Quote Link to comment
Grampa_of_Oliva_n_Eden Posted November 24, 2010 Report Share Posted November 24, 2010 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 Quote Link to comment
asbo Posted November 24, 2010 Report Share Posted November 24, 2010 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. Quote Link to comment
crelf Posted November 24, 2010 Report Share Posted November 24, 2010 I have tried simply passing a reference to the graph to the sub-VI, but I've had no luck. That should work fine - post your code and we'll take a look at it for you. Quote Link to comment
orangefob7 Posted November 29, 2010 Author Report Share Posted November 29, 2010 All, Thanks again for your replies. Here is the sub VI. I believe what I tried was along the lines of what you suggested, but have a look. Thanks again, David Plot TC - show highest points.vi Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.