I have a window that has some Graph Builder, Filter and other elements. When I use the Filter, my Legend on Graph Builder can change size when some categories are excluded. Then the whole Graph Builder box would change size, then boxes that are to the right of it would move, and the whole window change sizes.... It breaks the design and annoys a lot.
Question: How do I put the Graph Builder in some box and set a fixed size so no matter how it resizes inside that box, outside does not move?
Spacer Boxes are very handy for controlling space in a window. Try this:
dt = New Table( "TestTable",<BR />Add Rows( 2 ),<BR />New Column( "x", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [2, 4] ) ),<BR />New Column( "y", Numeric, "Continuous", Format( "Best", 6 ), Set Values( [3, 5] ) ),<BR />New Column( "Cat", Character, "Nominal", Set Values( {"short", "a very long category"} ) )<BR />);<BR /><BR />HBox = H List Box(
V List Box(
Spacer Box(size(560, 0)),
dt << Graph Builder(
Size( 390, 368 ),
Show Control Panel( 0 ),
Variables( X( :x ), Y( :y ), Overlay( :Cat ) ),
Elements( Points( X, Y, Legend( 5 ) ) )
)
),
filter = dt << Data Filter(
Mode( Show( 1 ), Include( 1 ) ),
Add Filter(
columns( :Cat, ),
Display( :Cat, "Check Box Display" ),
)
)
);
NW = New Window( "Example", <<SHOW window=""></SHOW>
It creates a spacer box just above the graph builder. If the graph builder box goes below the width of the spacer box, the Data Filter will not move. However, if you interactively make the graph builder box bigger, you will again see the behavior you are currently experiencing.
To better see what the spacer box is doing for you, try replacing it with this one:
Spacer Box(size(560, 10), Color("yellow"))