cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
vishwasanj
Level V

Graph builder Frame size JSL

Hi All,

 

This might be an easy and quick fix. But I kinda struggling to find the right way to do it.

 

I am trying to figure out how to have a consistent frame size with all graphs in graphs builder and consistent legend settings. I run a FOR loop having numerical values at the end of data table. It could range from 1 to many columns and I try to plot all the columns in Y axis.

The main discrepancy occurs when the Y axis has only one parameter, that legend doesn't show up but having 2 or more parameters, the legend automatically shows up and I don't have to write a separate JSL command for it. Because of that, each graph looks different because of the lack of space in legend settings.

 

Any idea on how to resolve this?

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
uday_guntupalli
Level VIII

Re: Graph builder Frame size JSL

@vishwasanj

   The size argument and their parameters can be used to define and limit the size of your windows as shown in the example below . 

Graph Builder(
	Size( 1230, 650 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ), Y( :weight ) ),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 1 ) ) ),
	Elements( Position( 1, 2 ), Bar( X, Y, Legend( 2 ) ) )
)
Best
Uday

View solution in original post

12 REPLIES 12
uday_guntupalli
Level VIII

Re: Graph builder Frame size JSL

@vishwasanj

   The size argument and their parameters can be used to define and limit the size of your windows as shown in the example below . 

Graph Builder(
	Size( 1230, 650 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ), Y( :weight ) ),
	Elements( Position( 1, 1 ), Line( X, Y, Legend( 1 ) ) ),
	Elements( Position( 1, 2 ), Bar( X, Y, Legend( 2 ) ) )
)
Best
Uday
ErraticAttack
Level VI

Re: Graph builder Frame size JSL

This does not work.  The FRAME SIZE is dependent on the size of the legend / text areas around the FRAME.

Jordan
txnelson
Super User

Re: Graph builder Frame size JSL

The Size element sest the Frame(FrameBox()) size.

txnelson_0-1663553492782.png

 

It does not set the GraphBuilderContainerBox()

txnelson_1-1663553614327.png

Which is what I am guessing you expected the size to be set for.

Jim
ErraticAttack
Level VI

Re: Graph builder Frame size JSL

That is the opposite of what I want -- I need the FrameBox() only to be the specified size.  Here is some example code illustrating this.  The Size( 500, 500 ) is fed to both, but clearly the FrameBox() size is very much not (500, 500)

 

As a matter of fact, it's not even the GraphBuilderContainerBox() that you show that is set to the given size -- you first must remove the LegendBox(), then the remaining (title / axes / axes headers) is set to the (500,500) size.  It is just ridiculous!

 

There is literally no way to  set the FrameBox() (as in, if you had this within an Outline Box( "", Graph Builder( ... ) ) and did Outline Box[Frame Box( 1 )] << Frame Size( 500, 500 )) BEFORE / DURING instantiation of the GraphBuilder() box.  It can ONLY be done after the window and graph has been created.

 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Cars.jmp" );
New Window( "TEST",
	H List Box(
		Graph Builder(
			Size( 500, 500 ),
			Show Control Panel( 0 ),
			Fit to Window( "Off" ),
			Variables(
				X( :Make ),
				X( :Model, Position( 1 ) ),
				X( :Year, Position( 1 ) ),
				X( :Protection, Position( 1 ) ),
				X( :"D/P"n, Position( 1 ) ),
				X( :Size, Position( 1 ) ),
				X( :Doors, Position( 1 ) ),
				Y( :Wt ),
				Color( :Model )
			),
			Elements(
				Bar(
					X( 1 ),
					X( 2 ),
					X( 3 ),
					X( 4 ),
					X( 5 ),
					X( 6 ),
					X( 7 ),
					Y,
					Legend( 9 )
				)
			)
		)
	,
		Graph Builder(
			Size( 500, 500 ),
			Show Control Panel( 0 ),
			Fit to Window( "Off" ),
			Variables( X( :Make ), Y( :Wt ) ),
			Elements( Bar( X, Y, Legend( 11 ), Error Interval( "Standard Error" ) ) ),
			SendToReport(
				Dispatch(
					{},
					"Graph Builder",
					FrameBox,
					{Grid Line Order( 1 ), Reference Line Order( 2 )}
				)
			)
		)
	)
)

What I need is for the area that has the chart (the FrameBox()) to be a given fixed size, independent of what size my axis are or how complicated and long the text is.

ErraticAttack_1-1663713018939.png

 

 

Jordan
hogi
Level XII

Re: Graph builder Frame size JSL

Any update here?
sounds like a candidate for Tiny Traps in Jmp and JSL 

hogi_1-1721856106476.png

 

green: "Size"

blue: frame size

purple: plot size

 

 

Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
New Window("test",
H List Box(
Graph Builder(
	Size( 500, 300 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Variables(
		X( :name ),
		X( :age, Position( 1 ) ),
		X( :sex, Position( 1 ) ),
		Y( :height ),
		Group X( :sex )
	),
	Elements( Points( X( 1 ), X( 2 ), X( 3 ), Y) ),
	SendToReport(
		Dispatch( {}, {"height vs. name & 2 more"}, TextEditBox,
			{Set Text( "my title\!nspans over 2 lines" )}
		),
		Dispatch( {}, {:height}, TextEditBox,
			{Set Text( "very long Y axis title " ), Rotate Text( "Horizontal" )}
		)
	)
);,
Graph Builder(
	Size( 500, 300 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), Y( :height ), Group X( :age ) ),
	Elements( Points( X, Y ) ),
	SendToReport(
		Dispatch( {}, {:height}, TextEditBox,
			{Set Text( "x" ), Rotate Text( "Horizontal" )}
		)
	)
)));

 

BHarris
Level VI

Re: Graph builder Frame size JSL

I know this was a long time ago, but we were fighting this same problem a few months back and came up with this:

 

Names Default to Here( 1 );

win = Get Window List();

// find graph builder windows
graphs = Filter Each({w}, win,
	If(Length(w << XPath("//OutlineBox[@helpKey='Graph Builder']")) > 0, 1, 0)
);

// get the last Graph Builder
last_gb = graphs[N Items(graphs)][OutlineBox("Graph Builder")] << Get Scriptable Object;

// set size
last_gb << Fit to Window("Off");
// last_gb << Show Control Panel( 0 );
last_gb << Size(1000,800);

// copy picture
frame = (graphs[N Items(graphs)] << XPath( "//GraphBuilderBox" ))[1];
frame << Copy Picture;

The "fit to window" was key to getting the output plots to be exactly the right size.

hogi
Level XII

Re: Graph builder Frame size JSL

I also started with the hope that some combination of 

Fit to Window( "Off" ),

and

Size(...)

might solve the problem.

 

But when I realized that in the Code of @ErraticAttack both functions are used my hope was gone.
In the example, the different X labels lead to completely different sizes of the graph.
As long as there is no rectangl around the whole graph (including the axes), nobody will notice, that both have the same size.

Same issue with different sizes of the Y axis:

hogi_0-1701111395062.png

 

Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Cars.jmp" );
New Window( "TEST",
	V List Box(
Graph Builder(
	Size( 500, 200 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Fit to Window( "Off" ),
	Variables( X( :Make ), Y( :Wt ) ),
	Elements( Bar( X, Y ) )
)
	,
Graph Builder(
	Size( 500, 200 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Fit to Window( "Off" ),
	Variables( X( :Make ), Y( :Wt ) ),
	Elements( Bar( X, Y, Legend( 1 ) ) ),
	SendToReport(
		Dispatch( {}, "Wt", ScaleBox, {Format( "Engineering SI", 12 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( "Weight" )} )
	)
)
	)
)

 

hogi
Level XII

Re: Graph builder Frame size JSL

Graphs with matching frame size? Is this possible in Jmp?

 

I asked Jmp support (TS- 00076249) and got the answer:

 

Yes, I would say it is possible, but it may require quite a bit of scripting to accomplish this for all possible graphs you want to make - especially if you are talking about Graph Builder.

To account for the display resolution of the monitor currently in use, you can access a Windows dll that will return the resolution of the monitor.  You can use this to scale your pixel size specifications as desired.  However, if you are working in a multiple monitor environment where each monitor may have a different resolution, it becomes practically impossible to account for the resolution because there is no way to know which monitor your graph is on.

 

OK, So, how?

 

Is it really so complicated to generate graphs with matching sizes?

 

Use case:

We use PowerPoint to present our Jmp analyses.

To get smooth transitions from page to page, we want to create all graphs with the same frame size (same size for the outer box of the NxM subplots of a page - without axes) and the same font size of the axes and X/Y group labels. 

hogi
Level XII

Re: Graph builder Frame size JSL

I posted a wish in the wish list:
Functionality to generate graphs with defined plot region

 

let's see ...