04-13-2009 10:36 AM - edited 04-13-2009 10:38 AM
LV 8.6.1 - Win Vista
I've seen this question asked before, but the answers were 4-5 years ago, and maybe things are different now.
I have an X-Y graph (see attached pic) where I display a cursor and use the SHOW NAME attribute.
Outside the graph, the user can click on various things which change the location of the cursor, and change the name.
In other words, I am highlighting on the graph one of several selected points.
The trouble is that the name seems to only show in one position relative to the cursor itself; namely directly above.
As you can see in the pic, the name ( "NTE B Speed" ) is not readable.
I would like to apply some intelligence here, to make it more useful. Something like:
If cursor above Y-midline
Cursor = BELOW
else
Cursor = ABOVE
end if
If Cursor > X midline
Cursor = LeftSide
else
Cursor = RightSide
end if
The idea is to insure that the name is completely visible in all cases.
However, I can find no such property.
Suggested solutions include adding a ghost cursor which shows the name, and which I offset by an appropriate amount, and extending the plotted scale to allow room (meaning I have to handle all the auto-scaling stuff).
Is there a better way?
Would annotations help? I've never used them.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
Solved! Go to Solution.
04-14-2009 09:56 AM
04-14-2009 01:26 PM
BINGO!
That must be relatively new, I just upgraded to 8.6 and hadn't seen it yet.
It's not available when using properties of the ACTIVE CURSOR, it's only in the cursor list (I wonder why).
If you access the cursor list, then index the cursor you want, then adjust the LABEL OFFSET.X and / or Y, then it does what I need.
Thanks!
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-14-2009 01:36 PM
Just for the record, the OFFSET values are in the same units as the graph.
By that I mean that if you take the example pic above and offset it by X = 200, the label is centered over the 1800 RPM line.
It's not measuring pixels or anything.
That makes left or right-justifying complicated, since I don't know how long a string is, in RPM.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-14-2009 03:04 PM - edited 04-14-2009 03:04 PM
CoastalMaineBird wrote:... since I don't know how long a string is, in RPM.
Programming >>> Graphics & Sound >>> Picture Functions >>> Get Text Rect.vi
will return a cluster of the bounds of a rectangle for the text you specify with the style and font of your choosing.
Ben
04-14-2009 03:11 PM
Yes, but that returns width in pixels, and that means a whole bunch of math conversions. It can be done, but my hopes for a simple built-in function to do it are dashed.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
04-14-2009 03:39 PM