cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
KST-CPT
Level II

IR Chart label and LCL

I have the following script which works well, it creates multiple IR charts based off values in a list generated from the unique values from a datatable.  I would like to label each chart the same as the value in the list it was generated from.  I would also like to set all my lower control limits to 0.   I can't see how to do this.

 

summarize(SNTime2, UnitNames = by(Column("Sub_name")));
count_UnitNames = nitems(UnitNames);

New Window( "M11 Runtime times Summary - Control Chart",
V List Box(
for(i=1, i<=count_UnitNames, i++,
Control Chart(
Sample Label( :Date ),
Group Size( 1 ),
KSigma( 3 ),
Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement ),
Where( :Sub_name == UnitNames[i] ),
SendToReport(
Dispatch(
{"Individual Measurement of Mean(Runtime)"},
"2",
ScaleBox,
{Format( "hr:m:s", 11, 0 )}
)));
);
));

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: IR Chart label and LCL

The approaches I took to solve this issue was to use a saved limits table, where only a lower limit with the value of "0" is specified and also an example of specifying the LCL in the IM chart specification.


Names Default To Here( 1 );

// Setup some sample data
SNTime2 = Open( "$SAMPLE_DATA/Quality Control/Phase Historical Data.jmp" );
SNTime2:Force << set name("Mean(RunTime)");
SNTime2:Site << set name("Sub_name") << data type( character );
SNTime2 << New Column("Date",format("m/d/y"),formula(today()));

// create a limits table with just a lower limit of zero and save it
dtlim = New Table( "Limits",
	Add Rows( 1 ),
	New Column("_LimitsKey",
		Character( 4 ),
		"Nominal",
		Set Values( {"_LCL"} )
	),
	New Column("Mean(Runtime)",
		Numeric,
		"Continuous",
		Format( "Best", 10 ),
		Set Values( [0] ),
		Set Display Width
	)
);

close( dtlim, save("$TEMP\limits.jmp"));

// Run your code
Summarize( SNTime2, UnitNames = by( Column( "Sub_name" ) ) );
count_UnitNames = N Items( UnitNames );

New Window( "M11 Runtime times Summary - Control Chart",
	V List Box(
		For( i = 1, i <= count_UnitNames, i++,
			Control Chart(
				Sample Label( :Date ),
				Group Size( 1 ),
				KSigma( 3 ),
				Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement ),
				// Read in limits
				Get Limits( "$TEMP\limits.jmp" ),
				Where( :Sub_name == UnitNames[i] ),
				SendToReport(
					Dispatch(
						{"Individual Measurement of Mean(Runtime)"},
						"2",
						ScaleBox,
						{Format( "hr:m:s", 11, 0 )}
					)
				)
			)
		)
	)
);

Documentation on limits table usage can be found in the Quality and Process Methods book

     Help==>Books==>Quality and Process

and in the Scripting Index

     Help==>Scripting Index==>Control Chart

 

You can also just use the LCL specification on the IM chart to get the same results

// You can also just use the LCL paramater on the IM specification
Summarize( SNTime2, UnitNames = by( Column( "Sub_name" ) ) );
count_UnitNames = N Items( UnitNames );

New Window( "M11 Runtime times Summary - Control Chart",
	V List Box(
		For( i = 1, i <= count_UnitNames, i++,
			Control Chart(
				Sample Label( :Date ),
				Group Size( 1 ),
				KSigma( 3 ),
				Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement( LCL(0)) ),
				Where( :Sub_name == UnitNames[i] ),
				SendToReport(
					Dispatch(
						{"Individual Measurement of Mean(Runtime)"},
						"2",
						ScaleBox,
						{Format( "hr:m:s", 11, 0 )}
					)
				)
			)
		)
	)
);
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: IR Chart label and LCL

The approaches I took to solve this issue was to use a saved limits table, where only a lower limit with the value of "0" is specified and also an example of specifying the LCL in the IM chart specification.


Names Default To Here( 1 );

// Setup some sample data
SNTime2 = Open( "$SAMPLE_DATA/Quality Control/Phase Historical Data.jmp" );
SNTime2:Force << set name("Mean(RunTime)");
SNTime2:Site << set name("Sub_name") << data type( character );
SNTime2 << New Column("Date",format("m/d/y"),formula(today()));

// create a limits table with just a lower limit of zero and save it
dtlim = New Table( "Limits",
	Add Rows( 1 ),
	New Column("_LimitsKey",
		Character( 4 ),
		"Nominal",
		Set Values( {"_LCL"} )
	),
	New Column("Mean(Runtime)",
		Numeric,
		"Continuous",
		Format( "Best", 10 ),
		Set Values( [0] ),
		Set Display Width
	)
);

close( dtlim, save("$TEMP\limits.jmp"));

// Run your code
Summarize( SNTime2, UnitNames = by( Column( "Sub_name" ) ) );
count_UnitNames = N Items( UnitNames );

New Window( "M11 Runtime times Summary - Control Chart",
	V List Box(
		For( i = 1, i <= count_UnitNames, i++,
			Control Chart(
				Sample Label( :Date ),
				Group Size( 1 ),
				KSigma( 3 ),
				Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement ),
				// Read in limits
				Get Limits( "$TEMP\limits.jmp" ),
				Where( :Sub_name == UnitNames[i] ),
				SendToReport(
					Dispatch(
						{"Individual Measurement of Mean(Runtime)"},
						"2",
						ScaleBox,
						{Format( "hr:m:s", 11, 0 )}
					)
				)
			)
		)
	)
);

Documentation on limits table usage can be found in the Quality and Process Methods book

     Help==>Books==>Quality and Process

and in the Scripting Index

     Help==>Scripting Index==>Control Chart

 

You can also just use the LCL specification on the IM chart to get the same results

// You can also just use the LCL paramater on the IM specification
Summarize( SNTime2, UnitNames = by( Column( "Sub_name" ) ) );
count_UnitNames = N Items( UnitNames );

New Window( "M11 Runtime times Summary - Control Chart",
	V List Box(
		For( i = 1, i <= count_UnitNames, i++,
			Control Chart(
				Sample Label( :Date ),
				Group Size( 1 ),
				KSigma( 3 ),
				Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement( LCL(0)) ),
				Where( :Sub_name == UnitNames[i] ),
				SendToReport(
					Dispatch(
						{"Individual Measurement of Mean(Runtime)"},
						"2",
						ScaleBox,
						{Format( "hr:m:s", 11, 0 )}
					)
				)
			)
		)
	)
);
Jim
KST-CPT
Level II

Re: IR Chart label and LCL

Thank you that works for the limits. 

 

How do I change the name of the IR charts.  I produce about 16 to 20 charts in a vertical window.  When I create it from the table data they are all labeled with the Sub_name column value, but when I create it from the script they are labeled with "Control Chart" and "Individual Measurement of Mean(Runtime)".  I would like each chart to be labeled with the value in  UnitNames[i].

 

Thanks again.

txnelson
Super User

Re: IR Chart label and LCL

I will show you the changes necessary to do what you want, however, I will do it by showing you that you could figure this out all by yourself, because JMP will show you how to do this.

Your request is to change the name of the Outline Box that is created that repeats the title, "Individual Measurement of Mean(Runtime)".  So, the first step is to simply change that title in one of the outputs.

runtime1.PNG

Then go to the red triangle and save the script for the changed chart

Control Chart(
	Sample Label( :Date ),
	Group Size( 1 ),
	KSigma( 3 ),
	Chart Col( :Name( "Mean(RunTime)" ), Individual Measurement( LCL( 0 ) ) ),
	Where( :Sub_name == UnitNames[i] ),
	SendToReport(
		Dispatch(
			{},
			"Individual Measurement of Mean(RunTime)",
			OutlineBox,
			{Set Title( "This is the title I want to have" )}
		),
		Dispatch(
			{"Individual Measurement of Mean(RunTime)"},
			"2",
			ScaleBox,
			{Format( "hr:m:s", 13, 0 )}
		),
		Dispatch(
			{"Individual Measurement of Mean(RunTime)"},
			"Control Chart Limits frame",
			FrameBox,
			{Frame Size( 64, 208 )}
		)
	)
);

Note how JMP indicated how to change the chart to make the Outline Box title a different name

Dispatch(
			{},
			"Individual Measurement of Mean(RunTime)",
			OutlineBox,
			{Set Title( "This is the title I want to have" )}
		)

Now all you have to do, is to reincorporate this change back into your script, and substitute the title for the UnitNames[i], which is your list entries for your requested Sub_name

New Window( "M11 Runtime times Summary - Control Chart",
	V List Box(
		For( i = 1, i <= count_UnitNames, i++,
			Control Chart(
				Sample Label( :Date ),
				Group Size( 1 ),
				KSigma( 3 ),
				Chart Col( :Name( "Mean(Runtime)" ), Individual Measurement( LCL( 0 ) ) ),
				Where( :Sub_name == UnitNames[i] ),
				SendToReport(
				Dispatch(
					{},
					"Individual Measurement of Mean(RunTime)",
					OutlineBox,
					{Set Title( UnitNames[i] )}
				),
					Dispatch(
						{"Individual Measurement of Mean(Runtime)"},
						"2",
						ScaleBox,
						{Format( "hr:m:s", 11, 0 )}
					)
				)
			)
		)
	)
);

 

Jim