LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Show trace name on mouse over

Hi,

i want to show the trace name (the same name as the legend text) when the
user moves the cursor over a trace within a graph. Something like the
TOOLTIP Element, just a small text that appears next to the cursor and show
the name of the trace.
Thats because i have a graph with about 50 traces plotted and the user is
looking for an easy way to identify the trace.

Any ideas ?

Thank You

Norbert



0 Kudos
Message 1 of 8
(4,229 Views)

Hi Norbert,

 

in principle... it can be done using the function GetGraphCoordsFromPoint; but then you would need to compare these coordinates with all your plot data which seems quite time consuming; while it is possible displaying the mouse coordinates this way it will not work to correlate it with a graph in real time...

 

Wolfgang

0 Kudos
Message 2 of 8
(4,225 Views)

If you have Graph Cursors which are set to snap to the nearest plotted point, you can use GetGraphCursorIndex() to find which plot the point belongs to. It is then a simple matter to PlotText() with a suitable string at the cursor position, looping until the mouse button is released, and then DeleteGraphPlot() on the text just plotted.

 

JR

0 Kudos
Message 3 of 8
(4,223 Views)

Attached simple project illustrates the approach. Not exactly a popup - you need to left-click on the graph to get the description, then right-click when you have finished with it. Note the cursor colour has been set to Transparent, to avoid unnecessary clutter.

 

JR

Message 4 of 8
(4,204 Views)
Hello Wolfgang, hello jr_2005,

thanks for your help. I hoped that there is a buil in function that i didn't
see, but ok........so i have a little programming work to do 😉

Thanks

Norbert



"Norbert Rieper" <nrieper@isitec.de> schrieb im Newsbeitrag
news:4ca5d851@PYROS.natinst.com...
> Hi,
>
> i want to show the trace name (the same name as the legend text) when the
> user moves the cursor over a trace within a graph. Something like the
> TOOLTIP Element, just a small text that appears next to the cursor and
> show the name of the trace.
> Thats because i have a graph with about 50 traces plotted and the user is
> looking for an easy way to identify the trace.
>
> Any ideas ?
>
> Thank You
>
> Norbert
>
>
>


0 Kudos
Message 5 of 8
(4,159 Views)

Norbert:

 

I took JR's excellent example and expanded on it to do ID by mouseover.

I key it off EVENT_MOUSE_POINTER_MOVE.

I get a graph coordinate from the mouse coordinates using GetGraphCoordsFromPoint().

I use SetGraphCursor() to put a cursor at the mouse pointer, but then I turn right around and use GetGraphCursor() to move the cursor to the closest point on any plot (without me having to talk to Mr. Pythagoras!).

 

For development and demo purposes, I added options to Plot new data (randomized or not), and ID by click or ID by mouseover.

 

Play with the attached example and see if that's an approach that works for you.

 

Thanks for the great start JR!

Message 6 of 8
(4,138 Views)
Hi Al S,

that was exactly what i was looking for. Thank you very much, you saved me
some programming time...thanks 🙂

Norbert





"Al S" <x@no.email> schrieb im Newsbeitrag
news:1286473213392-1272222@exchange.ni.com...
> Norbert:
> &nbsp;
> I took JR's excellent example and expanded on it to do ID by mouseover.
> I key it off EVENT_MOUSE_POINTER_MOVE.
> I get a graph coordinate from the mouse coordinates using
> GetGraphCoordsFromPoint().
> I use SetGraphCursor() to put a cursor at the mouse pointer, but then I
> turn right around and use GetGraphCursor() to move the cursor to the
> closest point on any plot (without me having to talk to Mr. Pythagoras!).
> &nbsp;
> For development and demo purposes, I added options to Plot new data
> (randomized or not), and ID by click or ID by mouseover.
> &nbsp;
> Play with the attached example and see if that's an approach that works
> for you.
> &nbsp;
> Thanks for the great start JR!
>
>
> ID_Plot.zip:
> http://forums.ni.com/ni/attachments/ni/180/49338/1/ID_Plot.zip


0 Kudos
Message 7 of 8
(4,124 Views)

Hi Norbert,

 

now that you found your solution you should mark the thread as solved. And you should even consider donating some kudos to Al and JR recognizing their efforts and time and providing such valuable feedback.

0 Kudos
Message 8 of 8
(4,115 Views)