Jump to content

Resizing FP Graphs


Recommended Posts

It's always the little things that getcha...

Short version: I need to be able to programmically resize a graph at run time.

For the long version, go here. I've got 18 graphs, with anywhere from 1 (big graph) to 4 (quarter-sized graphs) of them visible at any one time. When one screen-full of graphs gets resized (by the User manipulating the window), they all have to be resized, even the ones that are hidden.

After resizing a few times, a lot of the other controls and indicators on the screen tend to get out of whack -- they move or stretch or whatever. I want to be able to hit a "reset" button that puts everything back to the baseline size/position. I thought I could use Position and Bounds to do this, but while Position works fine, Bounds is read-only. Using any of the "Plot Area" functions does just that -- resizes the plot area but the graph itself does not change size.

Tell me there's a simple solution to this that I haven't been able to come up with (or found doing a search here)...

Link to comment

I haven't looked through the other thread, and I haven't looked at how to do this recently, but one workaround you can use is calling an internal LV function to do the same resizing which is done using the cursor. You can see a simple example here.

This comes with the usual warning about calling undocumented features, etc. If you're going to use this in an EXE, change the source of the DLL to "LabVIEW". This should tell LV to go the lvrt.dll file when running as an EXE.

  • Like 1
Link to comment

I think you are looking for the 'PlorAreaSize' and 'PlotAreaPosition' these seem to do what you want:

<Plug>:

have you looked at my Resize/Align/Distribute toolset?

</plug>

Ton

Love those humongous graphics... tongue.gif

PlotArea functions just resize the plot area (the black part) not the whole graph (the outside grey part).

I will take a look at your toolset now!

Link to comment

Love those humongous graphics... tongue.gif

PlotArea functions just resize the plot area (the black part) not the whole graph (the outside grey part).

Strange, it works for me (LV 2009 and with a graph):

<object id="scPlayer" width="741" height="503"> <param name="movie" value="http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/jingswfplayer.swf"></param>'>http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/jingswfplayer.swf"></param> <param name="quality" value="high"></param> <param name="bgcolor" value="#FFFFFF"></param> <param name="flashVars" value="thumb=http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/FirstFrame.jpg&containerwidth=741&containerheight=503&content=http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/2010-05-20_2145.swf"></param> <param name="allowFullScreen" value="true"></param> <param name="scale" value="showall"></param> <param name="allowScriptAccess" value="always"></param> <param name="base" value="http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/"></param>'>http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/"></param> <embed src="http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/jingswfplayer.swf" quality="high" bgcolor="#FFFFFF" width="741" height="503" type="application/x-shockwave-flash" allowScriptAccess="always" flashVars="thumb=http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/FirstFrame.jpg&containerwidth=741&containerheight=503&content=http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/2010-05-20_2145.swf" allowFullScreen="true" base="http://content.screencast.com/users/TonPlomp/folders/Jing/media/9ae3148f-d7a9-4255-91d8-ee0e1c48dfac/" scale="showall"></embed> </object>

Ton

Link to comment

I tried it in 8.6 with a graph, xy-graph and chart and in all cases the PlotAreaSize property resizes the bounds as well.

Hmm. I obviously need to figure out why it's not working for me...

I was hoping it was something that would only work in LV9 and then I'd have an actual reason to upgrade. smile.gif

Link to comment

Do by chance resize the graph in multiple locations?

What code do you have, does our snippet work?

The User resizes the entire window manually which resizes the group of graphs. The code only resizes programmatically in one place.

Yes, your snippet works.

Part of the issue, I think, is that not only am I resizing the graphs, I'm also moving them (back to their original positions). And to make it more complicated, all those graphs are in a group that resizes with the pane size. And of course, I'm also resizing the window to it's original size...

I actually discovered just resizing the window to its original size gets at least the graphs fairly close. Unfortunately there are a lot of other controls/indicators on the window that end up in the wrong place, so I've got to tie them down. I also need it to be more than just fairly close, so I'll work some more with incorporating your snippet.

I think my main problem at the moment is doing things in the right order. And I would love to get a reference to my group of graphs so I could turn "resize with pane" off and on...

Link to comment

I think I've got it!

Resize the window first, then reposition the plots, then resize the plot area. Seems to be working, so far. Now I just have to clean up all the miscellaneous controls/indicators.

Thanks to Yair, François, asbo, and especially Ton!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.