Show/hide traces on graph


Justin

Recommended Posts

Hello,

I am using DAQFactory Lite 16.3 with a Labjack T7 to graph data from several pressure transducers. I am trying to set up my page so that I can turn graph traces on and off with the click of a static text component, but it's not working and I'm not sure why.

In order to hide the trace I'm trying to change the trace color to match the graph's background color. Maybe there's an easier way (?) but this works if I do it manually from the graph's properties dialogue. 

What I did was right click on the static text component, went to Properties, then the Action tab. I selected "Toggle Between" as the action, and under Action Channel put "Component.Pressure_Graph.Pressure_1.Color" where "Pressure_Graph" is the name of the graph as set in the Properties dialogue, and "Pressure_1" is the channel name for my pressure transducer. For Toggle Between I set it to "RGB(255,255,255)" and "RGB(0,70,255)".

After setting this up the static text component acts as a button (mouse cursor changes to a hand when I mouse over it, button outline appears when I click on it), but nothing happens to the trace on the graph. I've also tried changing the Action Channel to "Component._Graph2D.Pressure_1.Color" where "_Graph2D" is the name of the graph that appears in the Event/Function toolbar when I click on it; I'm not sure why it is different than the name I assigned it under properties. This didn't solve the problem, no change in behavior.

I'm not sure what I'm doing wrong, any suggestions?

Thanks!

Link to comment
Share on other sites

Changing the background color to make it invisible isn't going to work so well.  You would be better off using the functions for adding / removing traces.  You'd want to create some variables to determine which traces are displayed and which aren't, then create some script to look at those variables and add the ones that should be displayed.  You can use AddTrace(), DeleteAllTraces() and DeleteTrace().  I personally don't use DeleteTrace() much and find the script much easier to simply DeleteAllTraces() before entering a loop that then adds back any traces I want to display with AddTrace().  See 8.13 in the user's guide for a quick summary.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.