LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically moving cursor shows odd behavior

I was working on a bit of code that would snap the cursors on an XY Graph "Mouse Down?" event.  It worked like a charm when the cursor was on Plot0, but I noticed when I had the cursor on Plot1, it would move to a point not clicked.  See the attached VI.  Any suggestions? 

0 Kudos
Message 1 of 7
(3,546 Views)

I agree that this looks buggy. Even if you read the cursor position right after writing, the values disagree. They should disagree less, because it should snap to the closest point on the line.

 

 

 

(it works if you set the cursor to "free dragging" in the cursor configuration, but of course then in won't be on the plot line)

Message 2 of 7
(3,503 Views)

Well, after playing with it a bit more, it looks like if I set only the Cursor.PosX property it works correctly.  Still think the other behavior is buggy, but it works.

 

On a side note if anyone wants a little sub vi to move your cursors to whever you click on the plot, here ya go.

0 Kudos
Message 3 of 7
(3,485 Views)
Well if you are snapping it to a plot, why would you *want* to provide both values. All you need is the X.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 7
(3,412 Views)

@mikeporter wrote:
Well if you are snapping it to a plot, why would you *want* to provide both values. All you need is the X.

Mike...

I think you confused "want" with "the output of Map Coords To XY method results in a cluster which I then decided to use" 😛

0 Kudos
Message 5 of 7
(3,343 Views)

@mikeporter wrote:
Well if you are snapping it to a plot, why would you *want* to provide both values. All you need is the X.

No!

 

For a wavform graph, Yes, but NOT for an xy graph!

 

Imagine an xy graph describing a spiral, for example. There will be many Y values for any given X. What LabVIEW would need to do is find the closest point, which could be relatively expensive. We need to provide both x and y in order to snap to the closest point in the plane.

 

0 Kudos
Message 6 of 7
(3,313 Views)

Yscale can only be set for free cursors, see the property description. So if you change the cursor to free, then it will work.

 

The Yscale seems to still be set to 0 for plot- locked cursors. If you only set Y, then it will set the position based on Yscale 0.

 

I wonder what would happen in altebach's spiral if you first set X then Y (or vice-versa).

 

Also, you could have a look at this thread, where altenbach shows a solution how to set the position of a cursor locked to a plot.

 

Certified LabVIEW Architect
0 Kudos
Message 7 of 7
(2,977 Views)