01-25-2023 03:28 PM
The top right of my default XY Plot looks like this in the front panel.
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
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
01-25-2023 04:15 PM
01-26-2023 03:09 PM
I tried your scheme but it didn't work. Here is my block diagram.
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.
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
01-26-2023 03:23 PM
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...)
01-26-2023 04:26 PM
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
01-26-2023 05:12 PM
Here is a simple example to let you reposition the plot legend.
LV 2016
01-27-2023 08:00 AM
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.
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
01-27-2023 09:13 AM
@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.
01-27-2023 10:38 AM
@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 🙂
01-27-2023 10:44 AM
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