LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Reasonable graph panel scaling

Hi,

 

I'd like to have a panel that contains one xy graph control; the user should be allowed to scale the panel. I want the size of the graph to rescale so that it keeps filling the panel. This works, but unfortunately not as expected:

 

1) While the panel is scaled, the graph keeps its size; only after releasing the mouse button, the graph adjusts to the new size. This, of course, looks extremely ugly...

 

2) I only want to rescale the size of the graph, not the size of the fonts used throughout the graph (labels, annotations...): making the graph smaller should keep the font size, otherwise text might become unreadable.

 

It seems that 2) could be fixed programmatically (check for events, set font size...), but not by default.

 

If there is a better solution for 1 and 2, I'd be grateful to hear about. 

 

Thanks, Wolfgang

0 Kudos
Message 1 of 3
(3,698 Views)

Hey Wolfgang - 

 

Splitters are the best way to achieve what you're looking for.  The main idea is to handle the panel sizing event and operate the splitters by the amount that the panel is sizing.  I've created some sample code that should do what you're looking for and attached it below.  Also, attaching the controls to the splitters in the user interface editor instead of in the code may make the task even easier.  

 

Let me know if you have any questions -

 

NickB

National Instruments 

Message 2 of 3
(3,691 Views)

Hi Nick,

 

Many thanks! Indeed this approach improves things. Most importantly, font size remains the same now 🙂

 

However:

 

1) Sizing the panel quickly results in a temporarily transparent panel (ugly, too)

2) The 'Maximize' button does not rescale the graph

 

Concerning the documentation, the EVENT_PANEL_SIZING event is not listed in the InstallPanelCallback description...

 

Wolfgang

0 Kudos
Message 3 of 3
(3,683 Views)