cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
ComplexNerd
Level III

Variability Plot Loop for all selected columns with user specified setting

Hello guys,

 

I am fairly new to JMP Scripting. I need a small support. I am now designing a application which does the following

Step 1: when user clicks a button. Variability chart window opens where we specify all columns for plotting, x axis grouping and all setting from current active data table 

                                      obj = dt << Variability Chart();

Step 2:  I want to get the user specified items in seperate variables like 

                              col_list = list of all columns selected in obj  

                               x_grouping = all x variables specified 

.. for all arguments for Variability Chart()

 

Step 3: after extracting all info.. Now i will run a loop for each column variable but 

for i==1 (first column) i will plot the chart in report ... user will do some changes (eg add legend specify background color etc)

now i will apply this template(all settings in this plot) to all column and create a report in new window for each column.

 

I am facing problem in following : step 2 and step 3 how to extract the arguments for Variability Chart() and perform the action 

 

P.S: i am also planning to parallely implement this for other chart types \

Please guide

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: Variability Plot Loop for all selected columns with user specified setting

Step 1

obj = dt << Variability Chart();

will open the Variability Chart dialog box, and when the user clicks on OK, all of the charts will be run at that time.

However, once the Variability Chart has been run, you can query the script returned from the Variability Chart Platform and get the X's and Y's

obj = Variability Chart( Y( :NPN1, :PNP1 ), Model( "Main Effect" ), X( :SITE ) );

theScript = char(obj << get script);
theYsList = words(word(1,substr(theScript,contains(theScript,"Y(")+2),")"),",");
theXsList = words(word(1,substr(theScript,contains(theScript,"X(")+2),")"),",");

For step 2, you can query the Displayed Plot directly and get the various settings.  Take a look in the Scripting Index for how to get the framesize, min and max and increment for the various axes etc, that you will need to apply to the additional applications of the Variability Chart.

 

I think that your suggested approach is going to be more trouble than benefit.  I suggest that rather than using the Variability Chart dialog box, but you rather create your own dialog box, resembling the  Variability Chart dialog box, which will then set you get all of the information you need up front, and then steps 2 and 3 will become much easier to implement.

 

See the Scripting Guide for information on how to create your own new window.dialog box

Jim

View solution in original post

txnelson
Super User

Re: Variability Plot Loop for all selected columns with user specified setting

Here is an example of one way to handle what I believe you want to do.  The script is very incomplete, and needs a lot of exception handing added to it, but it should give you a starting point. 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
nw = New Window( "Col List Box Example",
	modal,
	H List Box(
		Col List Box( all, width( 250 ) ),
		V List Box(
			Lineup Box( N Col( 2 ),
				ybb = Button Box( "Y Col" ),
				Y = Col List Box( Show( "run" ) ),
				xbb = Button Box( "X Col" ),
				x = Col List Box(),
				Button Box( "Cancel",
					nw << close window;
					Throw();
				),
				Button Box( "OK",
					ycols = y << get items;
					xcols = x << get items;
				)
			)
		)
	)
);

// ycols and xcols now have been populated and you can then bring up one graph and
// let the user make the changes
nw = New Window( "Graphical Settings",
	modal,
	vc = dt << Variability Chart( Y( ycols[1] ), Model( "Main Effect" ), X( xcols[1] ) );
	vc << on close( 
		// In the closing of the Variability Chart capture the script
		theScript = Char( vc << get script );
	);
);


// Run all of the graphs
For Each( {theCol, index},ycols, Eval( Parse( Substitute( theScript, ycols[1], theCol ) ) ) );
Jim

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Variability Plot Loop for all selected columns with user specified setting

Easiest option would be to build the variability chart launcher UI yourself. If you don't want to do that, you could use << Get Script to get script which was launched and parse the columns from that

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");
dt << Distribution();

dist = Current Report()[OutlineBox(1)] << Get Scriptable Object;
dist << get script;
-Jarmo
txnelson
Super User

Re: Variability Plot Loop for all selected columns with user specified setting

Step 1

obj = dt << Variability Chart();

will open the Variability Chart dialog box, and when the user clicks on OK, all of the charts will be run at that time.

However, once the Variability Chart has been run, you can query the script returned from the Variability Chart Platform and get the X's and Y's

obj = Variability Chart( Y( :NPN1, :PNP1 ), Model( "Main Effect" ), X( :SITE ) );

theScript = char(obj << get script);
theYsList = words(word(1,substr(theScript,contains(theScript,"Y(")+2),")"),",");
theXsList = words(word(1,substr(theScript,contains(theScript,"X(")+2),")"),",");

For step 2, you can query the Displayed Plot directly and get the various settings.  Take a look in the Scripting Index for how to get the framesize, min and max and increment for the various axes etc, that you will need to apply to the additional applications of the Variability Chart.

 

I think that your suggested approach is going to be more trouble than benefit.  I suggest that rather than using the Variability Chart dialog box, but you rather create your own dialog box, resembling the  Variability Chart dialog box, which will then set you get all of the information you need up front, and then steps 2 and 3 will become much easier to implement.

 

See the Scripting Guide for information on how to create your own new window.dialog box

Jim
ComplexNerd
Level III

Re: Variability Plot Loop for all selected columns with user specified setting

@txnelson  Thank you so much for your insight. Actually my main goal is to have seperate report window for each coloumn. For example if i select 5 columns for Y and in the report we get plot for all 5 parameters. if i add legend , change color etc in 1st chart in Outline box i want to write a script to seperate each plot in seperate window while also using the changes i did to the 1st plot. Is there a way to achieve this. Pls suggest

txnelson
Super User

Re: Variability Plot Loop for all selected columns with user specified setting

Here is an example of one way to handle what I believe you want to do.  The script is very incomplete, and needs a lot of exception handing added to it, but it should give you a starting point. 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/semiconductor capability.jmp" );
nw = New Window( "Col List Box Example",
	modal,
	H List Box(
		Col List Box( all, width( 250 ) ),
		V List Box(
			Lineup Box( N Col( 2 ),
				ybb = Button Box( "Y Col" ),
				Y = Col List Box( Show( "run" ) ),
				xbb = Button Box( "X Col" ),
				x = Col List Box(),
				Button Box( "Cancel",
					nw << close window;
					Throw();
				),
				Button Box( "OK",
					ycols = y << get items;
					xcols = x << get items;
				)
			)
		)
	)
);

// ycols and xcols now have been populated and you can then bring up one graph and
// let the user make the changes
nw = New Window( "Graphical Settings",
	modal,
	vc = dt << Variability Chart( Y( ycols[1] ), Model( "Main Effect" ), X( xcols[1] ) );
	vc << on close( 
		// In the closing of the Variability Chart capture the script
		theScript = Char( vc << get script );
	);
);


// Run all of the graphs
For Each( {theCol, index},ycols, Eval( Parse( Substitute( theScript, ycols[1], theCol ) ) ) );
Jim