LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best way to programatically re-size graphs?

I have a window that pops up, containing X-Y graphs, that are say, 600 pixels wide.

Under some circumstances, I want to reduce this to say, 400 pixels, and uncover a cluster of numeric displays occupying the other space.

I would like to set the BOUNDS.WIDTH of the graph so that it extends right up to the POSITION.LEFT of the cluster.

But I can't adjust the BOUNDS.WIDTH of the graph itself (that property is read-only).

I can adjust the PLOT AREA.SIZE.WIDTH of the graph, which will affect the BOUNDS.WIDTH.

But I can't use that for calculations, because I don't know the margin between the plot area and the graph bounds.

I want it to work when the user re-sizes the window (All objects are scaled when window re-siz
es). He may resize the window, close it, open it again and the size remains as he left it. That means I can't use absolute pixel values to move things around.

I have thought of using decorations: a hidden rectangle that's the size of the small plot area, and another one that's the size of the large plot area. Then set the plot area's SIZE.WIDTH to the width of the small or large decoration. They decorations would scale along with everything else, and all would be OK.


1... Does anyone have a better / different idea?

2... If not, how should I get the reference to the decorations? They can't be named. Using the VI reference, I would have to pick out decorations #3 and #4 or something (there are other decorations already present). That just seems a bit fragile. How can I move these new ones to be #0, and #1 ??
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 4
(2,845 Views)
Hi,

Here's what I've used to do this;

1) Get the DesiredSize (bottom-top, right-left). The origin can be set, so
that should be easy...
2) Calculate the "Bounds" - DesiredSize.
3) Add the "PlotAreaSize" to the result.
4) Put it in the "PlotAreaSize".

The quoted names are property values of the graph. Just a tip: put it all in
a subvi that uses a refernce to the control.

The logic behind this is that the difference between the total bounds, and
the plot area is constant.

Regards,

Wiebe.


"CoastalMaineBird" wrote in message
news:50650000000800000053C70000-1079395200000@exchange.ni.com...
> I have a window that pops up, containing X-Y graphs, that are say, 600
> pixels wide.
>
> Under some circumstances, I want to reduce this to say, 400 pixels,
> and uncover a cluster of numeric displays occupying the other space.
>
> I would like to set the BOUNDS.WIDTH of the graph so that it extends
> right up to the POSITION.LEFT of the cluster.
>
> But I can't adjust the BOUNDS.WIDTH of the graph itself (that property
> is read-only).
>
> I can adjust the PLOT AREA.SIZE.WIDTH of the graph, which will affect
> the BOUNDS.WIDTH.
>
> But I can't use that for calculations, because I don't know the margin
> between the plot area and the graph bounds.
>
> I want it to work when the user re-sizes the window (All objects are
> scaled when window re-sizes). He may resize the window, close it,
> open it again and the size remains as he left it. That means I can't
> use absolute pixel values to move things around.
>
> I have thought of using decorations: a hidden rectangle that's the
> size of the small plot area, and another one that's the size of the
> large plot area. Then set the plot area's SIZE.WIDTH to the width of
> the small or large decoration. They decorations would scale along
> with everything else, and all would be OK.
>
>
> 1... Does anyone have a better / different idea?
>
> 2... If not, how should I get the reference to the decorations? They
> can't be named. Using the VI reference, I would have to pick out
> decorations #3 and #4 or something (there are other decorations
> already present). That just seems a bit fragile. How can I move
> these new ones to be #0, and #1 ??
0 Kudos
Message 2 of 4
(2,845 Views)
The logic behind this is that the difference between the total bounds, and the plot area is constant.

I don't think that's true, given the fact that the window may be resized, and the graphs will scale with it.

I *-THINK-* I have it working using a dummy button, rather than a decoration. If the button is hidden, it still re-sizes with the window. So I made a button that was the width of the small plot area, and another which is the width of the large plot area, and hid them both.

When the window pops up, I decide which I need, and set the graph's PLOT AREA to one width, or the other.

When the window resizes, the button scales too, and the next time the decision is made, the buttons are the right size as well.

I guess the
decoration idea was a tangent.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 3 of 4
(2,845 Views)
Hi,

"CoastalMaineBird" wrote in message
news:506500000005000000FE6A0100-1079395200000@exchange.ni.com...
> The logic behind this is that the difference between the total
> bounds, and the plot area is constant.
>

> I don't think that's true, given the fact that the window may be
> resized, and the graphs will scale with it.

I ment the difference between the graph's bound and the graph's plot area.
is constant. Not the difference between the panel bound and the plot area.

Here's my implementation...

Regards,

Wiebe.

> I *-THINK-* I have it working using a dummy button, rather than a
> decoration. If the button is hidden, it still re-sizes with the
> window. So I made a button that was the width of the small plot a
rea,
> and another which is the width of the large plot area, and hid them
> both.
>
> When the window pops up, I decide which I need, and set the graph's
> PLOT AREA to one width, or the other.
>
> When the window resizes, the button scales too, and the next time the
> decision is made, the buttons are the right size as well.
>
> I guess the decoration idea was a tangent.



[Attachment Growing Chart.vi, see below]
0 Kudos
Message 4 of 4
(2,845 Views)