01-24-2012 05:51 AM
Hey,
I'm using an XY graph to show a number of curves. To Highlight part of a curve that is above or below certain limits, I have two extra plots per curve, one for below the limit and another for above the limit.
Since I have quite a lot of curves and I'm using the "plot visibility checkbox" functionality, it would be nice to have only the "real curves" in the plot legend, while the limit graphs are hidden. Is there a a way to control what items are shown of the plot legend?
The only idea I've had so far is to place all the limit curves as the last elements of the plot array, and set the plot legend size to the number of curves before them in the array. The problem with this is that I want to use be able to scroll the plot legend if I have too many curves to show.
01-24-2012 07:45 AM
Another option, with some more work, could give you exactly what you want (and open possibilities for adding a ton of functionality).
In such situations, I usually show and use the legend of one graph while my data is displayed in another. You can put them in different panes if you want so that things scale properly when window/pane resizes.
Any plot attribute change events for your legend (graph) can be used to set attributes for your visible graph.
01-24-2012 11:02 PM
For these reasons I've previously used the graph's image layers instead of extra plots. The only problem with images is I've found they can become hideously slow if your graphs are big, so be weary of using them if you have resizeable elements.
01-25-2012 01:52 AM
Thanks for your advice, guys!
I will absolutely try the two graph method you described, Ravi!
kegghead: Do you know of any examples were this is made? I don't really understand how to use the image layers.
01-25-2012 08:05 AM
Indeed, check out examples\general\graphs\Graph Pictures.llb\Graph Plot Area Images.vi.
Once you're familiar with that, explore the various VIs in the Functions\Programming\Graphics & Sound\Pictures Functions palette and you ought to be able to draw most basic stuff onto the three different graph layers. I use them quite a bit for annotations, drawing range limits, overlays, etc. Just pick the right layer depending on where in the z-order you want the plot to appear relative to plots, grids, etc.
In the above plot, the left and right header text, the "+3.42 Da" banner and the dashed lines are drawn as overlays in the plot using the various image layers, for example.
-mje