LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Plot legend positioning

Message 11 of 27
(1,354 Views)

Bummer that its position is included in the Bounds. I'd hoped it wouldn't be but alas 🙂

 

While I'm here, shameless plug for my Idea Exchange entry about this very thing...

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Decouple-plot-legend-tools-etc-from-the-plot-graphic-...

 

(one of these days I'm going to break down and make a QControl to do this)

0 Kudos
Message 12 of 27
(1,338 Views)

I have often lamented at the poor quality of the plot options in LabVIEW. Specifically for your idea exchange, I have gone so far as to build a subpanel specifically to handle plot legend in a useful and meaningful way.

 

But it isn't just that. LabVIEW graphs need a LOT of little tweaks and performance boosts. Just off the top of my head:

  • Turning on point markers for waveforms with a large number of sample points will often crash LabVIEW or hog huge amounts of resources
  • Turning on point makers for waveforms with a large number of sample points is useless because EVERY sample point gets the marker. It doesn't help you differentiate channels for B&W outputs
  • Annotations are just... awful. They show up as yellow by default even on plots with a white background, and changing the color of them is buggy
  • Line style is completely washed out if you have line width set to anything other than minimum.
  • ... and most important they're just ugly. You need a HUGE amount of customization before you have something that's even close to report ready.

 

I know there's a bunch more frustrations I've had with the plots and graphs in LabVIEW, I just don't remember them all.

0 Kudos
Message 13 of 27
(1,328 Views)

I'll throw cursors out there as needing some work too. It's such an immensely useful concept, but I can never remember how to use them and have to play around with them for a while before I can get them to work the way I want them to.

 

@Bowen, how'd you manage to get the legend in a subpanel? Did you just duplicate the plot and hide the second one, just showing the legend of the second one somehow? I can imagine that working but, as we've seen with this thread, getting the sizing of the legend just right would be a pain 🙂

0 Kudos
Message 14 of 27
(1,315 Views)

Thank you very much. Your VI does the job. 

Girish 

0 Kudos
Message 15 of 27
(1,311 Views)

I tried to make a subVI out of it because I have other graphs in the main VI where I have to do the same thing. I made the XY Graph as an input to the subVI. Then I created a local variable from an XY graph in the main VI, and changed it to read. However I could not wire it to the subVI input. Hope there is a way to pass a graph to a subVI. 

Thank you. 

Girish

0 Kudos
Message 16 of 27
(1,302 Views)

You don't want to pass the graph's value to the subVI, you want to pass a reference to the graph itself.

 

Right click on the graph and select "Create Reference". Do the same in your subVI, and right click that and select "Create Control" and wire that to the connector pane.

 

You will also need to disconnect the property nodes from a specific control. Right click each node and select "Disconnect from control", and you'll get a new input to the property node- a control reference. In your subVI, wire the Control Reference control that you just made to each of the property node inputs. Last, connect the reference you made to the actual main plot to the subVI instead of connecting the wire of the plot. Then your subVI will work as expected.

 

Conceptually, the wire on the diagram is (basically) just the value of the control. In this case, it's just the plot data- no metadata about the plot itself, like the size, colors, etc. The reference to the control is a reference to the control itself, which has all of that metadata. Your subVI needs to not operate on the data itself, but on the control, so you'll need the reference to that control.

0 Kudos
Message 17 of 27
(1,273 Views)

I followed your steps but the I connect to the subvi in the main vi. I have connected the XY Graph reference control in the front panel to the subvi input. The front panel and block diagram of the subvi look like so

girish53_0-1674938122392.png

girish53_1-1674938164678.png

In my main VI when I try to connect I get an error. Here is how it looks

girish53_2-1674938574644.png The error says Wire: Class conflict.

What am I doing wrong?

Thank you. 

Girish

 

0 Kudos
Message 18 of 27
(1,253 Views)

@BertMcMahan wrote:

 

@Bowen, how'd you manage to get the legend in a subpanel? Did you just duplicate the plot and hide the second one, just showing the legend of the second one somehow? I can imagine that working but, as we've seen with this thread, getting the sizing of the legend just right would be a pain 🙂


Lots of nonsense is how I did it. But yes, you're basically right.

 

  • Subpanel VI:
    • Reference from main VI's XY Graph fed in. 
    • XY Graph off screen with legend visible in the subpanel view
    • On initialize it will copy main XY Graph's properties 
    • Autosize plot legend" disabled on the graph. Plot width set to some reasonable maximum size
    • Snag the "XY Graph": Plot Attribute change event and use that to update properties of main graph
  • Main VI:
    • XY Graph in it's own pane, set to autosize with pane
    • Double clicking on the graph brings up a subVI with plot properties. That subVI loads up another VI with a subpanel. Subpanel was needed so that I still can have the "scroll" effect if number of channels is > screen height.

End result looked like this

 

BowenM_1-1675097050822.png

 

I'd share the code, but it isn't code that I own.

 

0 Kudos
Message 19 of 27
(1,174 Views)

Sorry this is too complex for me. I will just copy paste the block diagram that works for all the graphs I have. Can you ask the owner to share the subvi?

Girish

0 Kudos
Message 20 of 27
(1,160 Views)