Thanks for the quick response. This won't work as the Picture Box contains axes and legend. I am using a lineup box so that I can align other elements with the x-axis. Simplified example:
dt = Data Table( "Big Class" );
gbBar = Graph Builder(
Size( 521, 452 ),
Show Control Panel( 0 ),
Variables( X( :age ) ),
Elements( Bar( X, Legend( 3 ) ) ),
SendToReport( Dispatch( {}, "age", ScaleBox, {Add Ref Line( 1.5, "Solid", "Medium Dark Red", "", 1 )} ) )
);
nw = New Window( "for testing",
Outline Box( "complicated plot",
Spacer Box( Size( 2, 10 ) ),
lu1 = Lineup Box( N Col( 3 ), Spacing( 0 ) )
)
);
lu1 << Append( Report( gbBar )[AxisBox( 2 )] );
lu1 << Append( Report( gbBar )[FrameBox( 1 )] );
lu1 << Append( Report( gbBar )[LegendBox( 1 )] );
//end of row
lu1 << Append( Spacer Box() );
lu1 << Append( Report( gbBar )[AxisBox( 1 )] );
lu1 << Append( Spacer Box() );
//end of row
lu1 << Append( Spacer Box() );
lu1 << Append( insrt_icons = H List Box() );
lu1 << Append( Spacer Box() );
numXAxisWidth = (gbBar << report)[AxisBox( 1 )] << get width;
numAges = N Items( Associative Array( Column( dt, "age" ) ) << get keys );
numOneIncr = (numXAxisWidth) / (numAges);
For( _i = 1, _i <= numAges, _i++,
insrt_icons << Append( Spacer Box( Size( numOneIncr, numOneIncr ), Color( _i ) ) )
);
I would be happy to learn an alternative approach. Initially, I tried using spacer boxes that match the width of elements (using << get width), but that failed because there was some margin I couldn't account for.