- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
FrameBox does not retain reference lines when inserted into another display box
I know that reference lines are a properties of Axis Boxes, but what is a workaround? The use case is to Lineup boxes to combine elements from multiple plots into one. I was unable to find my answer on the discussion boards here.
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",
OutlineBox("stuff",
db1 = H List Box();
)
);
db1 << Append(report(gbBar)[FrameBox(1)]);
jmpversion()
/*:
"14.3.0"
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
For completeness, here is a code example showing difference between Reference Line and V/H Line with << Add Graphics Script.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gbBar = dt << Graph Builder(
Size( 521, 452 ),
Show Control Panel( 0 ),
Variables( X( :age ) ),
Elements( Bar( X, Legend( 3 ) ) ),
SendToReport( Dispatch( {}, "age", ScaleBox, {Add Ref Line( 2.5, "Solid", "Medium Dark Red", "", 1 )} ) )
); // reference lines do not show up in FrameBox
fboxBar = Report( gbBar )[FrameBox( 1 )];
fboxBar <<
Add Graphics Script(
1, // draws the line first
Pen Color( "gray" );
Pen Size( 1 );
V Line([0.5, 1.5]);
); // graphics script applies to frame box, as required
nw = New Window("for testing",
lu1 = Lineup Box(fboxBar)
)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
Append the PictureBox() rather than the FrameBox()
db1 << Append(report(gbBar)[PictureBox(1)]);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: FrameBox does not retain reference lines when inserted into another display box
For completeness, here is a code example showing difference between Reference Line and V/H Line with << Add Graphics Script.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gbBar = dt << Graph Builder(
Size( 521, 452 ),
Show Control Panel( 0 ),
Variables( X( :age ) ),
Elements( Bar( X, Legend( 3 ) ) ),
SendToReport( Dispatch( {}, "age", ScaleBox, {Add Ref Line( 2.5, "Solid", "Medium Dark Red", "", 1 )} ) )
); // reference lines do not show up in FrameBox
fboxBar = Report( gbBar )[FrameBox( 1 )];
fboxBar <<
Add Graphics Script(
1, // draws the line first
Pen Color( "gray" );
Pen Size( 1 );
V Line([0.5, 1.5]);
); // graphics script applies to frame box, as required
nw = New Window("for testing",
lu1 = Lineup Box(fboxBar)
)