cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
miguello
Level VII

Can't change FrameBox size when creating report - only when all display boxes AND window created.

All, 

 

I have a script with function that creates a GraphBuilder. It then gets packed into display boxes and put into a new window. Somehow, commands to change FrameBox size from within the function are ignored, and I can only change it when window is created. Why is that? I'd like this functionality to be inside the function, so that it outputs a plot that does not need any additional tinkering with. Changing title works from within the function, why not changing size?

 

Here's an example with 3 different attempts to change FrameBox size - only the third one works.

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
X_Parameter = "height";
Y_Parameter = "weight";
groupColumn = "sex";
titleText = "Example";


GBfunction= Function( {dt, X_parameter, Y_Parameter, groupByColumnString, titleText = ""},
	groupByColumn = Column( dt, groupByColumnString );
	cb = Context Box(
		gb = Graph Builder(
			Size( 350, 600 ),
			Ignore Platform Preferences( 1 ),
			Show Control Panel( 0 ),
			Variables( X( Column( X_Parameter ) ), Y( Column( Y_Parameter ) ), Overlay( groupByColumn ) ), 

		);
	
		rgb = gb << Report;
		(rgbOB = ((rgb << XPath( "//OutlineBox[@helpKey = 'Graph Builder']" ))[1])) << Set Title( titleText );
		//Attempt #1
		(rgb << XPath( "(//OutlineBox//FrameBox)" )) << Frame Size( 350, 200 );
		//Attempt #2
		//(rgbOB << XPath( "//FrameBox" )) << Frame Size( 350, 200 );
	
	);
	Return( cb );
);

lub = Lineup Box( N Col( 3 ) );
lub << Append( GBfunction( dt, X_Parameter, Y_Parameter, groupColumn, titleText ) );
ob_group = Outline Box( "GB Function example: " || (dt << Get Name) );
ob_group << Append( lub );
nw = New Window( (dt << get name), ob_group );

//Attempt #3
rgb = ob_group << XPath( "//OutlineBox[@helpKey='Graph Builder']" );
//(rgb << XPath( "(//OutlineBox//FrameBox)" )) << Frame Size( 350, 200 );
3 REPLIES 3
jthi
Super User

Re: Can't change FrameBox size when creating report - only when all display boxes AND window created.

I think changing the frame size doesn't work properly as the frame hasn't yet been visualized, some auto-resizing does take over and there can potentially also be some timing issues.

-Jarmo
miguello
Level VII

Re: Can't change FrameBox size when creating report - only when all display boxes AND window created.

I tried setting auto stretching to 0 and stretching to none, obviously, didn't help

jthi
Super User

Re: Can't change FrameBox size when creating report - only when all display boxes AND window created.

Figuring out what is forcing the size to be something weird is not always easy. Is there a specific reason why you aren't utilizing Graph Builder's << Size? I know that sometimes it can require some pre-calculations for example when using groups or wrapping

View more...
Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
X_Parameter = "height";
Y_Parameter = "weight";
groupColumn = "sex";
titleText = "Example";


GBfunction = Function({dt, X_parameter, Y_Parameter, groupByColumnString, titleText = ""}, {Default Local},
	groupByColumn = Column(dt, groupByColumnString);
	cb = Context Box(
		gb = dt << Graph Builder(
			Size(100, 100),
			Ignore Platform Preferences(1),
			Show Control Panel(0),
			//Fit To Window("Off"),
			Variables(
				X(Column(X_Parameter)), 
				Y(Column(Y_Parameter)), 
				Overlay(groupByColumn)
			),
		);
	);
	
	rgb = Report(gb);
	(rgbOB = ((rgb << XPath("//OutlineBox[@helpKey = 'Graph Builder']"))[1])) << Set Title(titleText);
	fbs = rgb << XPath("(//OutlineBox//FrameBox)");
	gb << Size(400, 250);
	
	Return(cb);
);

lub = Lineup Box(N Col(3));
lub << Append(GBfunction(dt, X_Parameter, Y_Parameter, groupColumn, titleText));
ob_group = Outline Box("GB Function example: " || (dt << Get Name));
ob_group << Append(lub);
nw = New Window((dt << get name), ob_group);
-Jarmo

Recommended Articles