LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Generate Event on change in Plot Legend for XY Graph

Hi,
 
I have two XY graphs on the front panel and would like to maintain a common plot legend such that any change in the plot legend affects both graphs.
 
Objective: I would like any value change in plot legend to fire an event.
 
How do I program that?
 
I know of value change event for the graph but am unable to find something specific to the plot legend. Other option is to have the user press a "refresh" button that will fire the event.
 
Feel free to share thoughts on other elegant methods to achieve the same objective.
 
Thanks,
Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 1 of 8
(4,862 Views)
Hi, Gurdas.

Have you looked at the Plot Attribute Change Event? It's described in the LabVIEW help as follows: "Generated when the user changes an attribute of a plot on a graph or chart by right-clicking the plot in the plot legend and selecting an item from the shortcut menu." Depending on the sorts of changes you'd like to catch, this could be exactly what you want. By only displaying the plot legend on one of the graphs, you can catch the event and then use property nodes to transfer the settings to the other graph's legend as well.

Good luck!
Sarah K.
Search PME
National Instruments
Message 2 of 8
(4,841 Views)

Hi Sarah,

Looks like you are talking of exactly what I want!

I have attached a sample VI to try achieve what I want. But it still has some issues which are:

1) I am unable to configure a Plot Attribute Change Event. I have used a mouse leave event instead. How does one configure a Plot Attribute Change Event?

2) Is there no single property which will transfer all the settings of plot legend from one graph to plot legend of another graph? In my sample VI, I have to read each property of the master graph and feed it into the slave graph.

Kindly note I am using LV FDS 7.1 on Win2000

Thanks,

Gurdas

Message Edited by Gurdas on 03-27-2006 11:51 PM

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 3 of 8
(4,837 Views)

You could also put your prop nodes in the timeout event (~50 mSec).  That way you don't have to mouse out of the master graph to see the changes.  You don't even really need the event structure for this technique.  One weirdness, when changing the color, the slave plot updates as you hover over the colors and the master waits till you click it Smiley Surprised.  I'm also in LV7.1, I suspect the attribute Sarah mentioned is a LV8 option.  Sarah?

Another output I wish was available in the Prop Nodes would be: # of plots.  That way you could loop through the active plots and change all plot parameters with multiple plots on the graph.

K

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 8
(4,826 Views)

Hi,

We finally used a boolean to sync the two graphs as per first graph's plot legend. We found this to be the most definitive (Sarah's is still better) and least process intensive. Any other technique was doing sync irrespective of its need. Our plots are multiplot (upto 15 plots on each graph). We use the array size function on the graph data to find number of plots. And then a For loop (equal to array size) within which the plot legend params for slave graph are updated (upon boolean press). For loop index is wired to Active Plot property.

Works flawlessly. Only hitch is a boolean needs to be clicked.

- Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 5 of 8
(4,814 Views)
How did you manage to handle the situation of someone selecting different common plots?  I couldn't figure a way to track the change between points only points connected by lines.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 6 of 8
(4,807 Views)

Hi,

Attached is code screenshot that we've used. Have tested and it works well.

I am not sure I've understood your comment. If my attached pic does not answer what you mentioned, kindly elaborate.

- Gurdas

Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
Message 7 of 8
(4,791 Views)

Thanks Gurdas,

My mistake.  I must not have wired the "plot.interp" because when I selected common plots> then the choice where there are only disconnected boxes,  the second graph switched to box points but the lines remained.  With I wired everything as in your example the secong graph updates fine.

 

Regards

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 8 of 8
(4,772 Views)