LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior setting size of intensity plot

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.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 1 of 11
(4,000 Views)

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.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 2 of 11
(3,992 Views)

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.

 

0 Kudos
Message 3 of 11
(3,980 Views)

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.

0 Kudos
Message 4 of 11
(3,950 Views)

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.

test.PNG

 

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.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 5 of 11
(3,912 Views)

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?

0 Kudos
Message 6 of 11
(3,890 Views)

 


@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)

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 7 of 11
(3,869 Views)

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?

0 Kudos
Message 8 of 11
(3,849 Views)

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.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 9 of 11
(3,808 Views)

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.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 10 of 11
(3,799 Views)