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
AT
AT
Level V

How to freeze control chart display when data is updated

Hi,

I have a script that read a csv file and does control chart. I like to automate this process so new data is updated, the control chart does not generate new charts. I like to only see on chart with updated data.

 

Here is the script I used. I appreciate your help. Thanks

 

------------------

Names Default To Here( 1 );

 

dt =Open(

"/Users/adatorab/Documents/JMP/PASS.csv",invisible);

 

obj = dt <<

Control Chart Builder(

Variables( Y( :A ) ),

Chart(

Position( 1 ),

Points(

Statistic(

"Individual"

)

),

Limits(

Sigma(

"Moving Range"

)

)

),

Chart(

Position( 2 ),

Points(

Statistic(

"Moving Range"

)

),

Limits(

Sigma(

"Moving Range"

)

)

)

);

obj << ShowWindow(0);

 

nw = New Window("Control Chart");

nw << Append(( H List Box( (obj << Report) << Clone Box)));

12 REPLIES 12
Byron_JMP
Staff

Re: How to freeze control chart display when data is updated

it looks like you've got a control chart builder report. The classic control charts work a little differently. (easier)

JMP Systems Engineer, Health and Life Sciences (Pharma)
ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to freeze control chart display when data is updated

I copied Bryon's control chart code into yours, added a random 'min' time, and here is what I see:

 

control chart random start.PNG 

 

//Open a window to show a control chart and then update
//the chart every 15 seconds
//Includes a button to refresh early.
 
Names Default To Here( 1 );
 
//Define variables here that need to keep their values through subsequent function calls
//This includes the window and data table
 
//Open a window to hold the chart (note this only happens once)
nw = New Window( "Control Chart", 
	V List Box(
		Button Box( "New Data", UpdateData() ), 
		holder = H List Box();
	)
);
 
//Make a variable to hold a reference to the data table
dt = .;
 
//A function that will update the chart
UpdateData = Function( {}, 
 
	//Close the table if it is already open
	Try( dt << Close Window );
 
	//Open data table
	dt = Open( "$SAMPLE_DATA/Abrasion.jmp", Private );
 
	//Make the control chart
	obj = dt << Control Chart(
		Group Size( 1 ),
		KSigma( 3 ),
		Chart Col( :Abrasion, Individual Measurement ),
		SendToReport(
			Dispatch(
				{"Individual Measurement of Abrasion"},
				"1",
				ScaleBox,
				{Min( nrows() - Floor( Random Uniform( 10, 25 ) ) ), Max( nrows() + 2 ), Inc( 5 ),
				Minor Ticks( 1 )}
			)
		)
	);
 
 
	//Hide the temporary control chart window
	obj << ShowWindow( 0 );
 
	//Remove existing/old graph from the window (if there is one)
	Try( (holder << Child) << Delete );
 
	//Add the new graph
	holder << Append( (H List Box( (obj << Report) << Clone Box )) );
 
	//Close the temporary control chart
	obj << Close Window;
 
);
 
//Script to update then chart and then call itself 15 seconds later
quickieScript = Expr(
 
	//Load the chart in the window (run the script in the function)
	UpdateData();
 
	//Run this same script in 5 seconds
	Schedule( 5, quickieScript );
 
);
 
//Start things off:
quickieScript;
AT
AT
Level V

Re: How to freeze control chart display when data is updated

Thanks so much for your help.