cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
novicescriptor
Level II

How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

Hi JMP users,

 

I am quite a novice in Scripting and would really appreciate a quick pointer. My script follows.   Question is where do I insert a command to send the heatmap report for each iteration to the same journal sequentially and what command should I use?

Script:

 

directory = Pick Directory( "Select a directory" );
Pick File( "Select JMP File", directory, {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "newJmpFile.jmp" );
For( i = 1, i < 5, i++,
	Graph Builder(
		Show Control Panel( 0 ),
		Variables( X( :RowN ), Y( :ColN ), Color( :bh ) ),
		Elements( Heatmap( X, Y, Color, Legend( 2 ) ) ),
		Local Data Filter(
			Location( {106, 106} ),
			Add Filter( columns( :SN ), Where( :SN == i ), Display( :SN, Size( 221, 259 ), List Display ) ),
			Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
		),
		SendToReport(
			Dispatch( {}, "RowN", ScaleBox, {Show Major Ticks( 0 ), Rotated Labels( "Automatic" )} ),
			Dispatch( {}, "ColN", ScaleBox, {Show Major Ticks( 0 )} ),
			Dispatch(
				{},
				"400",
				ScaleBox,
				{Legend Model(
					2,
					Properties(
						0,
						{gradient(
							{Color Theme( "Blue to Green to Red" ), Label Levels(
								[155 158 161 164 167 170 173 176 179 182 185]
							), Width( 15 ), Reverse Colors( 1 )}
						)}
					)
				)}
			)
		)
	)
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

I suggest you assign the Graph Builder object to a variable (gb) and then send << journal; to the appropriate display box of of the report of gb at the end of each iteration. See example below with two alternatives (the second commented out). The tree structure is often of great help to find the appropriate display box level. Here use gb << show tree structure to bring up the tree window.

for(i=1,i<5,i++,

    gb = Graph Builder(

    ........  

    );

    report(gb)[Framebox(1)]<<journal; // Just the heatmap

  //report(gb)[1]<<journal; // Whole graph with axes and legend.

);

View solution in original post

4 REPLIES 4
ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

I suggest you assign the Graph Builder object to a variable (gb) and then send << journal; to the appropriate display box of of the report of gb at the end of each iteration. See example below with two alternatives (the second commented out). The tree structure is often of great help to find the appropriate display box level. Here use gb << show tree structure to bring up the tree window.

for(i=1,i<5,i++,

    gb = Graph Builder(

    ........  

    );

    report(gb)[Framebox(1)]<<journal; // Just the heatmap

  //report(gb)[1]<<journal; // Whole graph with axes and legend.

);

novicescriptor
Level II

Re: How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

Hello MS,

I thank you very much for the answer to my questions.  Exactly what I am looking for.  No, I take it back - it is more than just what is needed here.  It opened the door for similar operations.

The variable assignment is the key - I actually tried that but didn't get the coding right:

     gb << journal, or

     report << journal

Also, the ; at end of gb, preceding the report to journal line is what I missed.

Lastly, thanks for the bonus on format/content to send.

I wanted to mark your answer as CORRECT and HELPFUL for 7 points if they let me. 

If I may ask one more question:

My FOR loop is not very elegant. I wanted to process a heatmap for every serial number (a different column) sequentially as they appear in the data filter.  Some kind of N Items command is needed but I could not get it right.  So I resorted to recoding the alphanumeric serial numbers into numerical order and use the basic FOR(i) loop.  Is there a quick way to directly employ the original alphanumeric (character) serial numbers?

Much appreciated,

Barry

ms
Super User (Alumni) ms
Super User (Alumni)

Re: How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

You can make a list of all levels and then loop through the N Items(list) levels. Individual items of list is retrieved with an index, e.g. list.Below is one way to incorporate that in your script (some code omitted).

Summarize( SNs = by( :SN) ); // Make List of all levels (serial numbers)

for(i=1, i<=N Items( SNs ), i++,

    gb = Graph Builder(....

Local Data Filter(

            Location( {106, 106} ),

            Add Filter(

                columns( :SN ),

                Where( :SN == SNs[i] ), // i'th item of list SNs

                Display( :SN, Size( 221, 259 ), List Display )

            ),

            Mode( Select( 0 ), Show( 1 ), Include( 1 ) )

        ),...

       

      );

        ...

    )


novicescriptor
Level II

Re: How to send Graph Builder report (Heatmap) to Journal for each FOR Iteration?

Hello MS,

Again, worked like a charm. Thanks for two "get out of jail" passes!

I knew it would involve N Items somehow but could not find the link, which in this case is the Summarize function that generates a list of unique column items.  I searched for Unique, Count etc., to no avail.

I wish the Scripting Guide could be more searchable.

Thanks again,

Barry