LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shifting the plot with mouse

Hi all,

i am displaying 4 channel data on a graph.

Is there any way i can shift the postion(up or down) of any plot on the graph with the mouse?

 

Thanks

Ritesh

 

0 Kudos
Message 1 of 18
(3,677 Views)
I think you can define one axis per plot. And then if you activate (per Property Node) one of them plots and select move tool, so you will be able to shift the position of them.
Message 2 of 18
(3,668 Views)

What do you mean by "moving the graph"? You can pan a graph using the graph palette. See the LabVIEW Help on graphs.

 

Or, are you trying to select a one of the plots with a mouse and then physically move it in terms of changing its data values? 

Message 3 of 18
(3,648 Views)

smercurio_fc wrote:

Or, are you trying to select a one of the plots with a mouse and then physically move it in terms of changing its data values? 


Exactly what i want.

 

Thanks

Ritesh

0 Kudos
Message 4 of 18
(3,642 Views)
Selecting a plot based on a mouse click is not too difficult. I wrote an example for this, which you can find here. The second part requires that you track the mouse move event and then determine how much to move the plot by based on the mouse movement. This requires changing the data values of the plot. Panning will, in essence, move the scale along with the plot. It sounds, though, that you want to keep the scale fixed and move the actual curve, sort of like adding an offset to the data by using mouse movements. This seems a little odd to me. May I ask why you are trying to do this? Are you sure you're not just trying to pan?
Message 5 of 18
(3,636 Views)

smercurio_fc,

you got it right. i want to select a plot by clicking it and shift it up or down depending on the movement of the mouse. or in simple terms i want to drag a plot up or down, without changing the scale.

Thing is like this, i have a 4 channel data. the data actually is almost same with a difference of +- 10. but i am adding an offset to all the channels so that they could accomodate on whole of the screen. so, sometimes i want to have a closer look at 2 or more of the channels. so i need to superimpose those plots, or just drag and keep it very near to each other. it might sound weird. but this thing is application specific and the user has really appreciated this idea as it helps them alot in analzing the data.

 

Waiting for a positive reply.

 

Thanks

Ritesh

0 Kudos
Message 6 of 18
(3,621 Views)
Well, if you want to use the mouse movement then you would need to do something like I had suggested, and you should take a look at the example I linked to as a starting point. Another alternative is to provide two controls. One to select the plot that you want to move (there's an example of this in that same thread I linked to), and another to provide the shift. Since you're only moving in one direction this would be quite easy to do. You have your graph data in a shift register and respond to the value change events of both controls. For one you highlight the plot. For the other you use the "old value" and "new value" from the event structure to get your new offset, add it to the data, and write the value back to the graph. Try that, and see how far you get.
Message 7 of 18
(3,592 Views)

Since this is something I shall re-use soon, I have developed a solution to your question. To highlight the selected plot, instead of the solution proposed by smercurio, it uses a dedicated invoke node (there are a few that are not so popular... ;))

Enjoy ! 🙂 

Chilly Charly    (aka CC)
Message 8 of 18
(3,581 Views)

Thanks alot guys.

 

@Chilly Charl,

Thanks alot for your program. it really helped me understand how to effectively use event programming.

And that exactly was the thing i was looking for. :smileyhappy:

 

Ritesh

 

0 Kudos
Message 9 of 18
(3,540 Views)

Hi,

I just wrote the the same function adding some more feature that i want.

I am using a boolean control. For TRUE, it acquires the data and displays it. For FALSE, it looks for any event to occur.

It works fine except for 1 case.

When the boolean is TRUE, and i move the cursor on the Graph, the VI just hangs. i cant click boolean or stop again. i have to use "abort execution" to stop the Vi.

 

I am attaching my code here. pls have a look at it let me know where is the fault.

 

Thanks,

Ritesh

0 Kudos
Message 10 of 18
(3,495 Views)