Thanks. I tried this and I get no error but I don't see x axis only twenty points.
Can you help further? I appreciate it a lot.
//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 Builder(
Show Two Shewhart Charts( 0 ),
Show Control Panel( 0 ),
Show Capability( 0 ),
Variables( Y( :Abrasion ) ),
Chart(
Points( Statistic( "Individual" ) ),
Limits( Sigma( Moving Range ) ),
//Warnings( Test 1( 1 ) )
SendToReport(
Dispatch(
{"Individual Measurement of Abrasion"},
"1",
ScaleBox,
{Min( nrows()-20 ), 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 );
//Wait a moment to show when the chart updates
Wait(0.2);
//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 15 seconds
Schedule( 15, quickieScript );
);
//Start things off:
quickieScript;