feed = Open Datafeed( );
myScript = Expr(
	line = feed << Get Line;
	If( Length( line ) >= 14,
		x = NumSubstr( line, 11, 3 ) );
		If( !Is Missing( x ),
			dt << Add Row( {thickness = x} )
		);
	);
);
feed << Set Script( myScript );
dt = New Table( "Gap Width" ); // make a data table with one column
dc = dt << New Column( "gap", Numeric, Best );
 
// set up control chart properties
dt << Set Property(
	"Control Limits",
	{XBar( Avg( 20 ), LCL( 19.8 ), UCL( 20.2 ) )}
);
dt << Set Property( "Sigma", 0.1 );
 
// make the data feed
feed = Open Datafeed();
feedScript = Expr(
	line = feed << Get Line;
	z = Num( line );
	Show( line, z ); // if logging or debugging
	If( !Is Missing( z ),
		dt << Add Row( {:gap = z} )
	);
);
feed << Set Script( feedScript );
 
// start the control chart
Control Chart(
	Sample Size( 5 ),
	K Sigma( 3 ),
	Chart Col(
		gap,
		XBar(
			Connect Points( 1 ),
			Show Points( 1 ),
			Show Center Line( 1 ),
			Show Control Limits( 1 )
		),
		R(
			Connect Points( 1 ),
			Show Points( 1 ),
			Show Center Line( 1 ),
			Show Control Limits( 1 )
		)
	)
);
 
/* Either start the feed from the device or test-feed some data
 to see it work (comment out one of the lines):
 feed << Connect( Port( "com1:" ), Baud( 9600 ) );*/
For( i = 1, i <= 20, i++,
	feed << Queue Line( Char( 20 + Random Uniform() * .1 ) );
	Wait( .1 ); // simulate a delay in the feed
);
You can further automate the production setting by placing a data feed script such as the one above in an On Open data table property. A property with this name is run automatically each time the table is opened (unless you set a preference to suppress execution). If you save such a data table as a template, opening the template runs the data feed script and creates a new data table.

Help created on 7/12/2018