How to stretch GB to fill all available space?Let's say I have a 3 column Line Up box with some display boxes, and then as a second row I have an Unlineup Box with a Graph Builder inside.
Example can be seen by running this script:
dt = New Table( "DEMO",
Add Rows( 10 ),
New Column( "Category",
Character,
"Nominal",
Set Values( {"A", "A", "A", "A", "A", "B", "B", "B", "B", "B"} )
),
New Column( "X",
Character,
"Nominal",
Set Values( {"AA", "AD", "AC", "AD", "AC", "BD", "BF", "BF", "BD", "BS"} )
),
New Column( "Y_veryLongName_toMake_Tabulat_Large",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [12, 32, 42, 23, 21, 12, 34, 53, 23, 12] )
)
);
tab = dt << Tabulate(
Show Control Panel( 0 ),
Add Table(
Column Table(
Analysis Columns( :Y_veryLongName_toMake_Tabulat_Large ),
Statistics( Sum, Mean )
),
Row Table( Grouping Columns( :Category, :X ) )
)
);
gb = dt << Graph Builder(
//Size( 528, 464 ),
Show Control Panel( 0 ),
Variables(
X( :Category ),
X( :X, Position( 1 ) ),
Y( :Y_veryLongName_toMake_Tabulat_Large ),
Color( :Category )
),
Elements( Points( X( 1 ), X( 2 ), Y, Legend( 9 ) ) )
);
rtab = tab << Report;
rgb = gb << Report;
lb = LineUp Box(NCol(3), rtab, rtab, rtab, Unlineup Box(rgb) );
nw = New Window("DEMO", Show Menu(0), Show Toolbars(0), lb);So this is how it looks like:

Now, I want that Graph Builder to fill all the horizontal space. I don't know the size of that space, so I don't want to specify it directly, I just want it to fill all the space whatever is available.
I tried using Set Auto Stretching (1,0) on rgb, but it didn't help much.
Experimentally, I found out, that if I go to properties and change Stretching for X from Neutral to Fill for EACH AND EVERY BOX from Frame Box all the way to Outline Box, like that:

then it looks like I want it to look:

Questions:
1. Is this the only way?
2. If it is - how to script it?
Update: I guess I should be able to use XPath with ancestor-or-self (or in simpler variant just ancestor below), but I can't get it to work.
rgb << Xpath("//FrameBox/ancestor")Mass CustomizationRe: How to stretch GB to fill all available space?I think it works if you set Auto Stretching on the Frame Box after the report is cloned:
lb = LineUp Box(NCol(3), rtab, rtab, rtab, Unlineup Box(rgb) );
lb[FrameBox(1)] << Set Auto Stretching(1,0);
nw = New Window("DEMO", Show Menu(0), Show Toolbars(0), lb);
Stretching properties are usually cleared when boxes are cloned, because behaviors do not always translate when the layout changes.
Re: How to stretch GB to fill all available space?Well, it's a good way of doing that, except in my use case this script runs on many tables that a user consecutively loads, and this window nw gets those Line Up Boxes appended one after another. With each next table the previous one closes, so I cannot have live graphs, I need to have reports that would stay after the rtable is closed.
I tried running this expression:
gb_expr = Expr(
(gb = dt << Graph Builder(
//Size( 528, 464 ),
Show Control Panel(0),
Variables(X(:Category), X(:X, Position(1)), Y(:Y_veryLongName_toMake_Tabulat_Large), Color(:Category)),
Elements(Points(X(1), X(2), Y, Legend(9)))
))<<REPORT></REPORT>
but it didn't work. Any idea how to modify it so that Graph Builder wouldn't disappear from the window if I close the table?
Re: How to stretch GB to fill all available space?Other option would be also to create the graph builder directly inside the new window
Names Default To Here(1);
dt = New Table("DEMO",
Add Rows(10),
New Column("Category", Character, "Nominal", Set Values({"A", "A", "A", "A", "A", "B", "B", "B", "B", "B"})),
New Column("X", Character, "Nominal", Set Values({"AA", "AD", "AC", "AD", "AC", "BD", "BF", "BF", "BD", "BS"})),
New Column("Y_veryLongName_toMake_Tabulat_Large",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([12, 32, 42, 23, 21, 12, 34, 53, 23, 12])
)
);
tab = dt << Tabulate(
Show Control Panel(0),
Add Table(
Column Table(Analysis Columns(:Y_veryLongName_toMake_Tabulat_Large), Statistics(Sum, Mean)),
Row Table(Grouping Columns(:Category, :X))
)
);
gb_expr = Expr(
gb = dt << Graph Builder(
//Size( 528, 464 ),
Show Control Panel(0),
Variables(X(:Category), X(:X, Position(1)), Y(:Y_veryLongName_toMake_Tabulat_Large), Color(:Category)),
Elements(Points(X(1), X(2), Y, Legend(9)))
)
);
rtab = tab << Report;
lb = Lineup Box(N Col(3), rtab, rtab, rtab, Unlineup Box(gb_expr));
nw = New Window("DEMO", Show Menu(0), Show Toolbars(0), lb);
gb << Auto Stretching("On");Re: How to stretch GB to fill all available space?Ok, I tried to more things:
rgb << Fit To Window("On");This one did not work.
rgb[FrameBox(1)] << Set Auto Stretching(1,0);
This one, where I apply Auto Stretching to FrameBox, not the whole report - did work.
The questions that I bumped into in the process still stands: What is the proper syntax for XPath Axes? Like, ancestor, child, ancestor-or-self, etc....