LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

XY Plot legend positioning

The top right of my default XY Plot looks like this in the front panel. 

girish53_0-1674681686629.png

I programmatically set the plot name for two plots. The legend is set to Autosize. After I set the names the top right looks like this

girish53_1-1674681862580.png

How can I make the left edge of the legend to be to the right of the right edge of the graph after setting the plot names.

Thank you. 

Girish

 

0 Kudos
Message 1 of 27
(2,043 Views)

What you're looking for is the property node. The end result will look something like this

 

BowenM_0-1674684818381.png

 

Message 2 of 27
(2,026 Views)

I tried your scheme but it didn't work. Here is my block diagram.

girish53_0-1674766908331.png

I reset the plot name in the middle frame. In the first frame I printed the Bounds.Width. The last frame is similar to your block diagram. I could not figure how to add the POSITN cluster definition, so I have the two properties in the node instead. I also print the width after the plot names are set. Both values are the same. Therefore, the new LegLeft is in the graph territory as expected. Shown below.

girish53_1-1674767258061.png

I tried to change the Bounds.Width, but it did not let me write that property. For some reason it is a read-only property. 

Hope you will be able to figure out what is wrong in what I implemented.

Thank you. 

Girish

 

 

 

0 Kudos
Message 3 of 27
(1,974 Views)

1- Attach your code (backsaved for 2018), that way we don't have to recreate your diagram

2- You're using Plot Area width, not Bounds width. Plot area width is just the plot area. You need the width of the whole plot object, not just the Bounds. (I don't think the Legend is included in Bounds, but it might be...)

Message 4 of 27
(1,968 Views)

Unfortunately the diagram I showed you is a small part of a big VI. I cannot send that. I will try to create a VI to illustrate this specific issue. It will take some time. 

I did confirm that the property Area Width is in the submenu associated with Bounds. The Plot Area Bounds is a cluster with Left, Top, Right and Bottom members. I think bound includes the legend just based on what I observed when I was printing everything. But mysteriously the Area Width property is read only. Otherwise I could have manipulated it. Do you know if there an example out there in the Labview knowledge base? 

Thank you. 

Girish 

0 Kudos
Message 5 of 27
(1,957 Views)

Here is a simple example to let you reposition the plot legend.

 

LV 2016

0 Kudos
Message 6 of 27
(1,943 Views)

Thank you very much for sending the test VI. The main different is that in my case, I have Ex XY Graph. The behavior is different from a normal XY graph as shown below. 

girish53_0-1674827621026.png

I am attaching the modified VI. When you change the value of Plot 1 name string control you get the pic shown above.

Thank you. 

Girish

 

0 Kudos
Message 7 of 27
(1,891 Views)
@BertMcMahan wrote:

1- Attach your code (backsaved for 2018), that way we don't have to recreate your diagram

2- You're using Plot Area width, not Bounds width. Plot area width is just the plot area. You need the width of the whole plot object, not just the Bounds. (I don't think the Legend is included in Bounds, but it might be...)


Unfortunately, the legend position IS included in the graph position so if it starts above the graph it will throw off all calculations down the line.  Plus, it won't even move when you run your code since it thinks it's already at the "top".  You will have to initialize it lower than your graph and then bring it up.  Also, even the graph label is included in the bounds, but only if it's visible. Even something like the font and its size will change the bounds.  

 

Bottom line is that LabVIEW is really not designed for fancy GUI control and you will be fighting to line things up so it's all pretty, even when you change text lengths, etc.  You CAN do it, but I always just make a new control and use the regular align and distribute objects tools.  

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
Message 8 of 27
(1,882 Views)

@OP

 

I believe you were given all of the information you needed to solve this. But since I was a bit bored this morning, here's a little spoon-feeding 🙂

 

0 Kudos
Message 9 of 27
(1,870 Views)

Thank you. I can use some spoon feeding after going around in circles for a day trying to solve this problem. But, I am using labview2020, so can't use the file you sent yet because it is in 2021. Please send it for my version. Thank you again. 

Girish

0 Kudos
Message 10 of 27
(1,867 Views)