Subscribe Bookmark RSS Feed

Extracting the user selected parameters for the X and Y when plotting variability charts

zhouye0

Community Trekker

Joined:

Mar 2, 2016

Being really new to scripting in jmp. I have a question about this, here is a script that I wrote. What I intend to do is that I have two tables, Table one contains the limits of each test, for example, (keep in mind that the actual table has a few thousand tests, this is just an example)

Table 1

TestLower LimitUpper Limit
test 1310
test 23.412
test 3512

And the other table (Few thousand columns long) contains the test results

​Table 2

Test 1Test 2Test 3
568
56.18.11
5.26.238.12

And what I intend to do, is plot a variability chart for the second table for a few selected tests (4 or 5), and I would like the variability chart to autoplot reference lines based on limits from the first table - the upper and lower limit. Now I'm stuck in this situation where I dont know how to complete my script. Currently it looks like this, I can get the reference line to plot at a fixed point at, say "1". But what I want to be able to do is to extract whatever test that the user decides to plot, and extract the limits from the first data table, and plot the limits as a reference line.

Is there a way to extract the user selected parameters (X and Y) of the variability chart, and use that the search for its limits to plot the reference line? As of now, my code looks like this

dt_data1 = Data Table( 1 ); // the Limits table

dt_data2 = Data Table( 2 ); // the actual data table

//Start of GUI Window

//--------------------------------------------------------------------------------------------------

ColSel = Filter Col Selector( Data Table( dt_data1 ), 250, 10, ColumnToPlot = ColSel << Get Selected );

ColSel << Set Max Selected( 2 ); //Maximum allowed selected column is 1

win = New Window( "Test",

  <<modal,

  Text Box( "Columns to plot variability chart" ),

  ColSel,

  go = Button Box( "OK",

  ColumnToPlot = ColSel << Get Selected

  );

);

//-----------------------------------------------------------------------------------------------

//End of GUI Window

Wait( 1 );

Current Data Table(dt_data2);

Colnames = dt_data2 << Get Column Names(Numeric, string);

LowerLimit = colnames[2];

UpperLimit = colnames[3];

Current Data Table(dt_data1);

  Variability Chart(

  Max Iter( 100 ),

  Conv Limit( 0.00000001 ),

  Number Integration Abscissas( 128 ),

  Number Function Evals( 65536 ),

  Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

  Points Jittered( 1 ),

  Show Box Plots( 1 ),

  Std Dev Chart( 0 ),

  Show Range Bars( 1 ),

  SendToReport(

  Dispatch(

  " ",

  "2",

  ScaleBox,

  {Add Ref Line( 0, "Solid", "Black", "", 1 ),

  Add Ref Line( 1, "Solid", "Blue", "", 2); } //Replace 1 by value imported

  )

  )

  );

2 REPLIES
txnelson

Super User

Joined:

Jun 22, 2012

If you move the limits into the spec limits column property for each of the columns in your measurement data table, from your limits data table, the Variability Chart platform will automatically display the limits.

Here is a script that I wrote recently to answer a posted question on "Importing Control Limits".  this script reads from a limits data table and moves it into a measurement data table.

// Before running this script, open up the measurement and limits data tables.

// If you are using the two files I attached to the reply, the dtmeas = and 

// dtlim = statements below are pointing to the correct data table.  But if 

// you use different data tables, you need to change the Data Table names 

Names Default To Here( 1 ); 

dtmeas = Data Table( "Measurements Table" ); 

dtlim = Data Table( "Limits Table" );

 

// Split the data table based upon the Grade Code so each group is in a different 

// column 

dtsplitmeas = dtmeas << Split( Split By( :GRDBWT ), Split( :ACC Basis Weight ) );

   

// Get the column names from the split data table, which are really the different 

// Grade Codes 

cols = dtsplitmeas << get column names( string );

   

// Loop across the split data table and read the values for that column from the

// dtlim data table.  Populate the Spec Limits and Control Limits

For( i = 1, i <= N Cols( dtsplitmeas ), i++, 

       limrow = Try( (dtlim << get rows where( dtlim:Gradecode == cols[i] ))[1], . ); 

       If( Is Missing( limRow ) == 0,  

              specs = {LSL( . ), USL( . ), Target( . ), Show Limits( 1 )}; 

              specs["LSL"] = dtlim:LOW[limrow]; 

              specs["Target"] = dtlim:TARG[limrow]; 

              specs["USL"] = dtlim:HIGH[limrow]; 

              Column( dtsplitmeas, Char( cols[i] ) ) << set property( "spec limits", Eval( specs ) ); 

              controllimits = {XBar( Avg( a ), LCL( b ), UCL( c ) )}; 

              Substitute Into( controllimits, Expr( a ), dtlim:LWarn[limrow] ); 

              Substitute Into( controllimits, Expr( c ), dtlim:uwarn[limrow] ); 

              Substitute Into( controllimits, Expr( b ), dtlim:targ[limrow] ); 

              Column( dtsplitmeas, Char( cols[i] ) ) << set property( "control limits", Eval( controllimits ) ); 

       ); 

);

Jim
zhouye0

Community Trekker

Joined:

Mar 2, 2016

Thanks for pointing out that I can utilize the column properties to set the limits that way!