LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I create a selecting box on a XY graph?

I would like to create a slection box tool, i.e something that wiould allow me to select a part of the XY graph with the mouse, draw the corresponding box on the graph and return the coordinates of the box in the end. Is there a built-in tool for this?

 

Many thanks in advance

0 Kudos
Message 1 of 5
(4,067 Views)

This might not be slick enough for your application, but one option is to use cursors.

Add two cursors to the graph, with each one displaying vertical and horizontal lines. The user can then drag these around to form a rectangle on the plot area with the cursors being diagonally opposite corners of that rectangle.(See picture attached)

Using property nodes you can get the coordinates of the rectangle and it is simple to work out the coordinates of all four corners.

 

Is that what you were after?

 

Ian

0 Kudos
Message 2 of 5
(4,053 Views)

Sort of, it is the right direction and I had thought about it, but I was looking for something fancier (just the box plotted, defin it in one click...)

Thank you though. Any more suggestions?

0 Kudos
Message 3 of 5
(4,047 Views)

All LabVIEW graphs have front, middle, and back plot images (use property node to set and get them).  You can use this to draw just about anything on the graph.  The images are picture control data types, so you can put anything in them.  Using this would require using the event structure to capture mouse up, down, and move events and changing the picture as you dragged across the graph.  Clicking inside the newly created box could also be captured using mouse events.

 

Note that this is a non-trivial exercise, but fairly straightforward.  It is also very powerful, since you can modify the box/enclosure to be anything from a simple box to a circle/ellipse, polygon, or anything you can imagine.  The limit is your programming skills and, more importantly, patience.

 

Let us know if you need more help/suggestions.

Message 4 of 5
(4,032 Views)
Here is a rough example I made a while ago.

 

 

http://forums.ni.com/t5/LabVIEW/Select-a-region-in-plot/m-p/992166#M443883
Message 5 of 5
(4,026 Views)