From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Move legend of graph

Solved!
Go to solution

Hi

 

I'm a bit stuck with user interface modification.

I'd like to make it possible to manually move position of legend showed in a graph. Sort of right mouse click on legend, holding and dropping. It would be good enough to have the possible position within the graph.

 

Is this possible?

 

Thanks for any ideas.

Yves

 

0 Kudos
Message 1 of 5
(3,971 Views)

Hi Yves,

 

there is a "Legend.Position" property of the graph available - and it's writable…

So you can analyze mouse movement and adjust legend position interactively!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,952 Views)

Hi Gerd

 

Thank you for your reply. I found the example "dynamic event generation" that shows me the way. But isn't possible to point the event "mouse down on legend" instead of the chart?

 

Best regards,

Yves

0 Kudos
Message 3 of 5
(3,944 Views)
Solution
Accepted by topic author Yves

Hi Yves,

 

the legend is part of the chart indicator. You can only get events for the whole control/indicator…

 

(You might create your own plot legend using a (multicolumn) listbox or similar, then you get events for this "faked" legend - at the cost of additional programming overhead.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(3,941 Views)

I was just thinking of adding this to my graphs since, typical to my life, all the interesting data tends to wind up right under my legend and I don't want the legend sitting outside the graph plot area (Looks silly when exported).

 

Here's the concept I prototyped.  This prototype doesn't do the fancy stuff:

 

  • Adjust for drag offset
  • Detect middle or right mouse buttons
  • Interact with other events (I have a bunch of special click events like adding point annotations etc)
  • Prevent out of bounds legend movement
Message 5 of 5
(3,505 Views)