02-17-2011 04:19 PM
Hi all,
I have an intensity plot that i've customized to run time menu on. The options in the menu are 'Fit to Window' and 'Proportional', which change the size of the Plotting area. This all seems to work fine. However, if the window is Maximized and I hit Proportional there are issues when I un maximize. The proportional code itself works, but when I shrink the window, the intensity graph seems to forget that it's supposed to scale with the pane, and it's borders extend beyond the borders of the window. This probably isn't clear, so I'm attaching the relevant part of my code.
Directions to break:
Run proptest.vi
Maximize the window
Right click the graph and select Proportional
UnMaximize the Window
At this point you'll notice that the edge of the plot is no longer on the pane. (Everything works fine in 'Fit to Window' mode. For example the following works: maximize, proportional, fit to window, unmaximize works fine)
I'm stumped why this is happening, anyone have any ideas?
Please excuse the horribly ugly code, it's in the works.
02-17-2011 05:10 PM
So, when this happens, I can't resize it from the right because the plotting area is too small. So, when the window is unmaximized, I need to keep the plotting area the same size, and not autoscale it with rest of the graph. This is a hassle, unless someone knows a way to uncouple the plot size from the rest of the graph.
02-17-2011 09:49 PM
I've been fighting with similar issues myself. I don't have a great answer, but I think the underlying problem is that the size of the graph changes as the gray box that surrounds the graph changes. The gray box itself can't be manipulated programmatically, because it is related to the "bounds" property, which is read-only.
To get this under control, it helps a lot to understand how all the relevant properties behave and how they are related--that includes "bounds", "position", "plot area bounds", and "plot area size". Write a simple VI with an event structure, controls, and plenty of indicators to help figure out what each of these things do. In your VI, you will have to do some arithmetic in the proper order to get it to work.
If you ask me, the graph position and dimension properties are unintuitive and not well-designed. If they just totally got rid of the gray box and let you deal unencumbered with the graph, I think these problems wouldn't arise.
Good luck.
02-18-2011 03:06 PM
I see what you guys are talking about with the difference between the graph size and the size of the bounding gray box. I was also able to replicate the issue the OP posted. I'm going to look into whether or not this is the expected behavior of this interaction. If so, direct bounding box control may be a good feature request for future releases of LabVIEW.
02-21-2011 03:35 PM
So, I guess I'll update my status.
I came up with a viable solution...if I wasn't using an XControl.
After the (partial) resize, I adjust the size of the black area so it fills the grey area. Then I set the black area to the size of the window, and this brings the grey area with it.
This however does not work when the window is an XControl Facade VI. What happens in this case is the Facade VI shrinks with the grey area, which shrinks with the black area, which blocks it from shrinking appropriately. Therefore, the Facade VI, which I would use as the window in the above explanation, is not the correct size, since it got blocked by the graph failing to resize. Therefore, when I set the black area to be that size, it fills up the Facade VI, which is stretched beyond the window bounds, much like in my original post. VERY frustrating, and I don't see a way around it, since the XControl isn't necessarily maximized in the owning window, if I could even get that window's bounds.
02-22-2011 06:34 PM
Is this code you just posted the new code for "set fit" or "set proportional?" What is the significance of the [60,43] height and width?
02-23-2011 08:32 AM
@Kyle T wrote:
Is this code you just posted the new code for "set fit" or "set proportional?" What is the significance of the [60,43] height and width?
The code pictured is my new Set Fit. The [60,43] is the size of the border between the plotting area (black) bounds and the graph(grey) bounds. 60 pixels on both sides, 43 on top and bottom.
What I do is, from the Pane Resize event, I call the Fit code, then proportional (if proportional was selected)
02-24-2011 07:21 PM
I'm still looking at the code you originally posted and if I perform those steps to break it over and over, the intensity plot gets more and more out of proportion. That could have been a result of a small error in the math, or maybe something else. If I could, I'd like to look at your more recent code to see what's changed. As far as using XControls, what feature or property would need to be added to allow you to do what you're trying to accomplish?
02-28-2011 09:03 AM
Sorry for the delay, work's been busy. I've attached the most recent versions of my test, fit and proportional VIs. I haven't put together a barebones XControl yet, but may get to it today.
02-28-2011 09:49 AM
Need a longer edit time.
Anyway, this morning I made an XControl to show the difference in behaviors. Prop Test and XProp Test are the two VIs you'll run. In both cases, start by maximizing the window. Then, hit proportional. Then unmaximize the window. Prop Test behaves properly but XProp Test does not. The Resize events and "Set View" events in both Prop Test and XProp Facade are basically identical.