Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
jsrmfh
Level I

JMP 14.2 - JSL - Graph Builder Size Ignored Inside Boxes Sent to Journal

Full disclosure - I'm a bigger fan of the older graph plotting routines in JSL than Graph Builder but I'm making some honest attempts to switch.

 

I'm running into a problem where I'm dynamically adding graphs to a Journal and I'm trying to very tightly control the graph sizes so axes and values line up horizontally. I'm building an H List Box in JSL with several items, sending that H List Box to the Journal, and then doing the same thing on another parameter. However, when I use Graph Builder, the Size attributes appear to be completely ignored and all GraphBuilders end up in what appears to be 300x300px. When I build the graphs via other graphing routes (variability plots, control chart, overlay plot), this just doesn't happen. It works.

 

I tried going about this a different way and made some test code to do the exact same addition of the H List Box to a new window instead of the Journal and everything works as expected. See the image below with the incorrect Journal output on left and the correct "New Window" output on right. Anyone know what's going on here with the Journal and what steps need to be taken to mitigate?

jsrmfh_0-1598380137617.png

Windows JMP 14.2

 

Example test code using Big Class example data table.

//Uses BigClass example data

// Create array of parameters
ParameterArray = {"height", "weight"};
numbatches = nrows(Current Data Table());
wind = New Window( "Example");

// Loop through parameters
for (i = 1, i <= N Items(ParameterArray),i++,
	ColName = ParameterArray[i];
	
		// Create charts
	xBox = H List Box ();
	
	xBox << append(	gbbp = Graph Builder(
			Size( 150, 300 ),
			Show Control Panel( 0 ),
			Variables( Y( Column( ColName ) ), Overlay( :sex ) ),
			Elements( Box Plot( Y, Legend( 2 ) ) ),
			SendToReport(
				Dispatch(
					{},
					ColName,
					ScaleBox,
					{Label Row( {Major Grid Line Color( -14277081 ), Show Major Grid( 1 )} )
					}
				),
				Dispatch( {}, "400", LegendBox, {Set Title( "" )} )
			)
		);
	);
		
	xBox << append(	gb = Graph Builder(
			Size( 900, 300 ),
			Show Control Panel( 0 ),
			Legend Position( "Inside Left" ),
			Variables( X( :age ), Y( Column( ColName ) ), Overlay( :sex ) ),
			Elements( Line( X, Y, Legend( 32 ) ) ),
			SendToReport(
				Dispatch(
					{},
					"Graph Builder",
					OutlineBox,
					{Set Title( ColName || " Chart" )}
				),
				Dispatch(
					{},
					"graph title",
					TextEditBox,
					{Set Text( ColName || " Chart" )}
				),
				Dispatch( {}, "400", LegendBox, {Sides( "Left" )} )
			)
		);
	);


	// Save to journal
	xBox << journal;
	wind << append(xBox);

);

 

2 REPLIES 2
Highlighted
Jeff_Perkinson
Community Manager Community Manager

Re: JMP 14.2 - JSL - Graph Builder Size Ignored Inside Boxes Sent to Journal

I don't know if this will be the solution but try turning Fit to Window off.

 

2020-08-25_16-00-25.899.png

 

Graph Builder(
	Size( 457, 479 ),
	Fit to Window( "Off" ),
	Variables( X( :weight ), Y( :height ) ),
	Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) )
);
-Jeff
Highlighted
jsrmfh
Level I

Re: JMP 14.2 - JSL - Graph Builder Size Ignored Inside Boxes Sent to Journal

Thanks Jeff,

That doesn't seem to fix it either. For anyone else who's having this problem I've simply circled around the issue by building a window and then sending that window to the Journal. Doing so feels hacky since we're circling through another part of the UI to get to the destination, but it gets the job done.

Also - I noticed that I had an extra variable in my code example which prevented its running. I've corrected the original post.
Article Labels