News
We’re asking you to select a content label when starting a new topic in the Discussions area. Read more to find out why.
Choose Language Hide Translation Bar
Highlighted
derchieh
Level II

combine graph windows via loop

Hi,

 

I have a long list of response variables to graph and I'd like to group them in separate windows where each window is a pre-defined category. Then I want to combine all the reports (graph windows) and create a Dashboard. When I go to Window -> Combine Windows (which I had used before for different purposes) the reports are not listed as options for combining. Can anyone help please?

 

Below is the JMP script I used to generate the graphs with a sample data table. For this example, suppose we want a separate graph window for each airline.

 

Thank you.

Derchieh

 

 

 

 

Names Default to Here(1);

sourcedt = Open("$SAMPLE_DATA\Airline Delays.jmp");

dt = sourcedt << Stack(
	columns( :Elapsed Time, :Arrival Delay, :Distance ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Value" )
);

Summarize(dt, al = By(:Airline));
Summarize(dt, mon = By(:Month));
Summarize(dt, para = By(:Label));


For (j = 1, j <= NItems(al), j++,
	New Window( al[j],
		V List Box(
	
			For (i = 1, i <= NItems(para), i++,
		
			 Graph Builder(
					Size(230, 300),
					Fit to Window( "Off" ),
					Show Control Panel(0),
					Variables( X( :Month ), Y( :Value ), Overlay( :Day of Week ) ),
					Elements( Points( X, Y, Legend( 1 ) ) ),
					Where( :Airline == al[j] & :Label == para[i] ),
					SendToReport(
					Dispatch(
						{},
						"Value",
						ScaleBox,
						{Min( -10 ),  Minor Ticks( 0 )}
					),
					Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
					Dispatch( {}, "Y title", TextEditBox, {Set Text( para[i] )} )
					)
				) << report;
			)
		)
	)
);

 

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
txnelson
Super User

Re: combine graph windows via loop

The issue you are running into, is that you have not saved the pointers to the different windows that you have created.  I have modified your script(see below), to save the references to the 6 windows you create, to a list called "alWindowList".  It contains the six pointers to the windows.  It can be used in a Combine Window to join the windows together.

I also noticed in your script, that the displaying of the Airline and Label is not being displayed in a meaningful way, so I also modified the script to force the code to use the actual values, rather than the al[j] and para[i] display.

Names Default To Here( 1 );

sourcedt = Open( "$SAMPLE_DATA\Airline Delays.jmp" );

dt = sourcedt << Stack(
	columns( :Elapsed Time, :Arrival Delay, :Distance ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Value" )
);

Summarize( dt, al = By( :Airline ) );
Summarize( dt, mon = By( :Month ) );
Summarize( dt, para = By( :Label ) );
alWindowList = {};

For( j = 1, j <= N Items( al ), j++,
	nw = New Window( al[j],
		V List Box(
	
			For( i = 1, i <= N Items( para ), i++,
				Eval(
					Substitute(
							Expr(
								Graph Builder(
									Size( 230, 300 ),
									Fit to Window( "Off" ),
									Show Control Panel( 0 ),
									Variables( X( :Month ), Y( :Value ), Overlay( :Day of Week ) ),
									Elements( Points( X, Y, Legend( 1 ) ) ),
									Where( :Airline == __al__ & :Label == __para__ ),
									SendToReport(
										Dispatch( {}, "Value", ScaleBox, {Min( -10 ), Minor Ticks( 0 )} ),
										Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
										Dispatch( {}, "Y title", TextEditBox, {Set Text( para[i] )} )
									)
								) << report
							),
						Expr( __al__ ), al[j],
						Expr( __para__ ), para[i]
					)
				)
			)
		)
	);
	Insert Into( alWindowList, nw );
);
Jim

View solution in original post

3 REPLIES 3
Highlighted
txnelson
Super User

Re: combine graph windows via loop

The issue you are running into, is that you have not saved the pointers to the different windows that you have created.  I have modified your script(see below), to save the references to the 6 windows you create, to a list called "alWindowList".  It contains the six pointers to the windows.  It can be used in a Combine Window to join the windows together.

I also noticed in your script, that the displaying of the Airline and Label is not being displayed in a meaningful way, so I also modified the script to force the code to use the actual values, rather than the al[j] and para[i] display.

Names Default To Here( 1 );

sourcedt = Open( "$SAMPLE_DATA\Airline Delays.jmp" );

dt = sourcedt << Stack(
	columns( :Elapsed Time, :Arrival Delay, :Distance ),
	Source Label Column( "Label" ),
	Stacked Data Column( "Value" )
);

Summarize( dt, al = By( :Airline ) );
Summarize( dt, mon = By( :Month ) );
Summarize( dt, para = By( :Label ) );
alWindowList = {};

For( j = 1, j <= N Items( al ), j++,
	nw = New Window( al[j],
		V List Box(
	
			For( i = 1, i <= N Items( para ), i++,
				Eval(
					Substitute(
							Expr(
								Graph Builder(
									Size( 230, 300 ),
									Fit to Window( "Off" ),
									Show Control Panel( 0 ),
									Variables( X( :Month ), Y( :Value ), Overlay( :Day of Week ) ),
									Elements( Points( X, Y, Legend( 1 ) ) ),
									Where( :Airline == __al__ & :Label == __para__ ),
									SendToReport(
										Dispatch( {}, "Value", ScaleBox, {Min( -10 ), Minor Ticks( 0 )} ),
										Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
										Dispatch( {}, "Y title", TextEditBox, {Set Text( para[i] )} )
									)
								) << report
							),
						Expr( __al__ ), al[j],
						Expr( __para__ ), para[i]
					)
				)
			)
		)
	);
	Insert Into( alWindowList, nw );
);
Jim

View solution in original post

Highlighted
derchieh
Level II

Re: combine graph windows via loop

Thank you so much for your reply! I get it now. Thanks!

 

0 Kudos
Highlighted
derchieh
Level II

Re: combine graph windows via loop

Hi txnelson,

 

I have to reuse this (similar) code for a different context, but it doesn't seem to work anymore. That is, the Window titles don't appear in the list for Combine Window or as available reports to add to a Dashboard. I rerun your code below, the same problem exist. We recently upgrade to 14.2.....could that be the problem?

 

Many thanks.

Derchieh

0 Kudos