cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
Akane
Level II

how to fix graph size when add multiple graphs in single window?

Hello,

I use For loop to create graph size (800,800) and add to the same window. When test the script only for one graph, size is correct. When added multiple graphs in single window, it will adjust y automatically and it is too narrow to review the data. 

Could you please advise how to fix graph size when add to the single window?

Thank you.

 

nw= New Window("Report");

For(j = 1, j <= nitems(mylist) , j++,
prod_list = mylist[j];
Gr1 = expr (Data Table(" Rej Rate "||prod_list) << Graph Builder(
	Size( 800,800 ),
.
.
);
nw << Append (Hlistbox(Gr1)); 
); // end for mylist loop

@msharp  I created new post as your comment. Thank you.

2 ACCEPTED SOLUTIONS

Accepted Solutions
msharp
Super User (Alumni)

Re: how to fix graph size when add multiple graphs in single window?

Akane, try appending it to a list box, not the window directly.  That should fix your issue.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

nw = New Window("Dashboard", hlb = hlistbox()); //vlistbox if you want it vertical

for(i=1, i<10, i++,
	g = expr(dt << Graph Builder(
		Size( 800, 800 ),
		Show Control Panel( 0 ),
		Variables( X( :name ), Y( :age ) ),
		Elements( Points( X, Y, Legend( 5 ) ) )
	));
	hlb << Append(g);
);

Also, instead of calling Data Table's by name, its a better practice to store the data table reference in a variable and call that.

So....

//Bad Practice
mylist = {"name1", "name2"};
For(j = 1, j <= nitems(mylist) , j++,
prod_list = mylist[j];
Gr1 = expr (Data Table(" Rej Rate "||prod_list) << Graph Builder(
	Size( 800,800 ),
	
//Good Practice
mylist = {dt1, dt2};
For(j = 1, j <= nitems(mylist) , j++,
dt = mylist[j];
Gr1 = expr (dt << Graph Builder(
	Size( 800,800 ),

 

View solution in original post

Re: how to fix graph size when add multiple graphs in single window?

Another solution would be to add:

 

Fit To Window("off")

as part of your Graph Builder() command.  By default Graph Builder automatically decides whether to stretch with the window or maintain a constant size.  I think the solution that @msharp provided changes the auto-stretching behavior.  I'm actually not sure why that changes things - this may be a bug that you are working around.

View solution in original post

3 REPLIES 3
msharp
Super User (Alumni)

Re: how to fix graph size when add multiple graphs in single window?

Akane, try appending it to a list box, not the window directly.  That should fix your issue.

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

nw = New Window("Dashboard", hlb = hlistbox()); //vlistbox if you want it vertical

for(i=1, i<10, i++,
	g = expr(dt << Graph Builder(
		Size( 800, 800 ),
		Show Control Panel( 0 ),
		Variables( X( :name ), Y( :age ) ),
		Elements( Points( X, Y, Legend( 5 ) ) )
	));
	hlb << Append(g);
);

Also, instead of calling Data Table's by name, its a better practice to store the data table reference in a variable and call that.

So....

//Bad Practice
mylist = {"name1", "name2"};
For(j = 1, j <= nitems(mylist) , j++,
prod_list = mylist[j];
Gr1 = expr (Data Table(" Rej Rate "||prod_list) << Graph Builder(
	Size( 800,800 ),
	
//Good Practice
mylist = {dt1, dt2};
For(j = 1, j <= nitems(mylist) , j++,
dt = mylist[j];
Gr1 = expr (dt << Graph Builder(
	Size( 800,800 ),

 

Re: how to fix graph size when add multiple graphs in single window?

Another solution would be to add:

 

Fit To Window("off")

as part of your Graph Builder() command.  By default Graph Builder automatically decides whether to stretch with the window or maintain a constant size.  I think the solution that @msharp provided changes the auto-stretching behavior.  I'm actually not sure why that changes things - this may be a bug that you are working around.

Akane
Level II

Re: how to fix graph size when add multiple graphs in single window?

Thank you. It works both method.