LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph Legend Callback (CVI)

Hi,
How can I build callback function to graph legend (so that when you click on legend item only that particular curve is shown)? Thanks in advance...
0 Kudos
Message 1 of 2
(3,149 Views)
Just put a graph where you want the legend and add a callback function for the graph. Convert the graph to a legend with the LGConvertGraphToLegend function. Then, the graph callback will be setup to handle the legend events (of course, legends are not "Hot" controls, so no COMMIT events. Just LEFT_CLICK's, etc.)

As for how to add and remove curves based on clicks, the eventdata1 and eventdata2, will have the X,Y position of the mouse. You should be able to use that to tell which plot they clicked on in the legend, and then clear the graph and replot that plot only.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 2
(3,149 Views)