cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
Neo
Neo
Level VI

Organize journal in a grid while copying open charts to journal within a loop

Currently my code snippet below copies open charts (distributions and heatmaps) into a journal depending on the occurrence of specific text (e.g. "Distribution") in window name list (postWindowList) of the open charts.

However, the journal gets the chart one below the other in one column. I would like them the charts to be in a MXN grid. How to achieve this from within the loop?

istart =  LengthOfpreWindowList + 2;  //e.g. istart = 10
iend = LengthOfpostWindowList;   //e.g. iend = 24

nw = New Window( "My Report" , <<journal);
For( i = istart, i <= iend, i++,
	If( Contains(postWindowList[i], "Distribution" ),
		Window (postWindowList [i])[outlinebox(2)]<< journal,
		Window (postWindowList [i])[outlinebox(1)]<< journal;
	)
);

 I am on JMP 13.

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
Neo
Neo
Level VI

Re: Organize journal in a grid while copying open charts to journal within a loop

Thanks, your script changes what I getting by default (i.e. vertically aligned charts in one column) to horizontally aligned charts.

However, I was able to use hlb1, hlb2, and so on (and assigning them appropriately within the for loop) to copy what I wanted in a MxN grid of the journal.

This will do nicely for what I am after at the moment. 

When it's too good to be true, it's neither

View solution in original post

4 REPLIES 4
txnelson
Super User

Re: Organize journal in a grid while copying open charts to journal within a loop

I believe this will work.

nw = New Window( "My Report" , <<journal,
	hlb = H List Box()
);
For( i = istart, i <= iend, i++,
	If( Contains(postWindowList[i], "Distribution" ),
		hlb << Append(Window (postWindowList [i])[outlinebox(2)]),
		hlb << Append(Window (postWindowList [i])[outlinebox(1)]);
	)
);

I strongly recommend that you take the time to read the Scripting Guide, found in the JMP Documentation Library, available under the Help pull down menu.!!!

Jim
Neo
Neo
Level VI

Re: Organize journal in a grid while copying open charts to journal within a loop

Thanks, your script changes what I getting by default (i.e. vertically aligned charts in one column) to horizontally aligned charts.

However, I was able to use hlb1, hlb2, and so on (and assigning them appropriately within the for loop) to copy what I wanted in a MxN grid of the journal.

This will do nicely for what I am after at the moment. 

When it's too good to be true, it's neither
txnelson
Super User

Re: Organize journal in a grid while copying open charts to journal within a loop

I believe a better solution for you is to take my script and add @pauldeen suggestion.  It will give you the MxN matrix without having to do the hb1,hb2 coding

nw = New Window( "My Report" , <<journal,
	hlb = Lineup Box( NCol( 5 ))
);
For( i = istart, i <= iend, i++,
	If( Contains(postWindowList[i], "Distribution" ),
		hlb << Append(Window (postWindowList [i])[outlinebox(2)]),
		hlb << Append(Window (postWindowList [i])[outlinebox(1)]);
	)
);

If you replace the 5 in the NCol() function with the number of columns you want in your output, it will automatically fill in as many rows as necessary to present all of your output.

Jim
pauldeen
Level VI

Re: Organize journal in a grid while copying open charts to journal within a loop

You should look at a lineup box where you can specify the N part of your M*N list. Then you can just append things to that box and eventually journal the box.