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
BooBee
Level III

Can JSL be used to automate plotting of charts and adding of ref lines among others

Hi,

 

I plot Distribution charts on a regular basis. Some days I get just a few columns of data, some days quite a bit more.

 

Once the individual charts are generated, I will need to adjust their respective min/max Y axis for readability, and then add in a couple of reference lines (basically USL and LSL lines).  After a while, it gets tedious, especially there are a lot of columns of data.

 

I would like to see if there is any way of automating this process since the process itself is relatively straightforward and repeating. I'm thinking of JSL scripting can be the solution here (I'm very new to scripting).

This is what I would like the script to do:
1. Each column of data consists of 5 data points, with the 1st and 2nd row containing the USL and LSL respectively
2. The script should read all the columns of data 

3. Plot individual Distribution charts for all the data

4. Add in USL and LSL reference lines (can we set the line thickness and color here?)

5. Then change the Min of the Y axis to LSL-0.003 and Max of Y axis to USL to USL+0.003

 

Can JSL do the above?

 

Thank you!

12 REPLIES 12
ErraticAttack
Level VI

Re: Can JSL be used to automate plotting of charts and adding of ref lines among others

You have dt as the file path, so it is a string.  You need to have it reference the newly opened file, like below.  Notice the Open() statement

 

Names Default To Here( 1 );

// Open a dialog to choose a .jmp file to open

// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( dt ),
	Throw(), 
	// Else Open the selected file
	dt = Open( dt )
);

// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );

// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
	Eval(
		Substitute(
				Expr(
					Column( dt, col ) << set property(
						"Spec Limits",
						{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
					)
				),
			Expr( _LSL_ ), As Column( dt, col )[1],
			Expr( _USL_ ), As Column( dt, col )[2]
		)
	)
);

// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;

// Run the Distribution Platform
dt << Distribution( column( eval(colNameList) ));
Jordan
BooBee
Level III

Re: Can JSL be used to automate plotting of charts and adding of ref lines among others

Moved to a new thread with a more relevant title.

pmroz
Super User

Re: Can JSL be used to automate plotting of charts and adding of ref lines among others

This code is a little cleaner:

// Get the filename of the .jmp file to open
filename = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");

// If the user did not select a file, exit the script
If( Is Missing( filename ),
	Throw(), 
	// Else Open the selected file
	dt = Open( filename )
);