Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
Tomer9w
Level I

automatic SPEC limits in var. charts

Hi

i created a script that generates a variability chart that shows in the Y axis: NewValue and in the X axis: ENTITY.

the variability chart is filtered by ATTRIBUTE_NAME so i get plenty of graphs, each for every attribute name.

i want the script to add the relevant SPEC limits from an additional data table (called: "Gases SPEC limits") to new columns and generate Variability Chart for each attribute name with its specific SPEC values.

 could not undertand how to do it, please help!

 

 

 

attached here is my failed script so far to generate USL manually for 3 different attributes:

 

dt = current data table();

dt << New Column ( "USL",
Numeric,
Continuous,
Formula ( If( :ATTRIBUTE_NAME == "Gas07TactrasFlowCheckF2",65,
If( :ATTRIBUTE_NAME == "Gas08TactrasFlowCheckF2", 70,
If( :ATTRIBUTE_NAME == "Gas04TactrasFlowCheckF2", 15, 10)
) ) )
);

varch = dt << Variability Chart(
Y( :NewValue ),
X( :ENTITY ),
By(:ATTRIBUTE_NAME),
Show Range Bars( 0 ),
Show Cell Means( 0 ),
Connect Cell Means( 0 ),
Show Separators( 0 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
AIAG Labels( 0 ),
ATTRIBUTE_NAME
SendToReport(
Dispatch(
{},
"1",
ScaleBox,
{Add Ref Line( __Upper__, "Solid", "Black", "gfgfd", 1 )}
),
Dispatch(
{},
"Oneway Plot",
FrameBox,
)
)

);

For(i=1,i<=N Rows(dt),i++,

report(varch)[axisbox (1)]<<Add Ref Line( dt:LSL[i], "Solid", "Dark Green","Target", 1 );

report(varch)[axisbox (1)]<<Add Ref Line( dt:USL[i], "Solid", "Dark Green","", 1 );

);

 

 

2 REPLIES 2
Highlighted
txnelson
Super User

Re: automatic SPEC limits in var. charts

There are 2 issues with your script

  1. The Variability Chart does not output 1 Report structure for it's output, but rather it outputs a report structure for each By group.  Therefore, specifying
    Report( varch )[AxisBox(1)]
    is an incorrect reference, it needs to specify which of the report structures you want to reference, such as for the "Gas07TactrasFlowCheckF2" which is alphabetically the first by group, the reference would be
    Report( varch[1] )[AxisBox(1)]
  2. Your For() loop is going to create a set of reference lines for each of the rows in your data table.  I am assuming you may have hundreds rows in your data table, and you would be writing the same lines over and over.  What you need to do, is to create a summary table with just one row for each VarChart that you are going to create, and then to go through that table and apply the values to the appropriate Variability Chart.

I have attached an example that illustrates how you might want to do your script

names default to here(1);
dt=Open("$SAMPLE_DATA/big class.jmp");

// add the USL and LSL to the data as in your example
dt << New Column( "LSL", formula(
	If(:Age == 12, 52,
		:Age == 13, 57,
		:Age == 14, 62,
		:Age == 15, 64,
		:Age == 16, 64,
		64
	)
));
dt << New Column( "USL", formula(
	If(:Age == 12, 65,
		:Age == 13, 66,
		:Age == 14, 70,
		:Age == 15, 70.5,
		:Age == 16, 71,
		72
	)
));


// Create a summary table with one row for each level of Age
dtSum = dt << Summary(
	Group( :age ),
	Mean( :LSL ),
	Mean( :USL ),
	Freq( "None" ),
	Weight( "None" ),
	statistics column name format( "column" )
);

varch = dt << Variability Chart( Y( :height ), X( :sex),by(:age));

// For each row of the summary table, take it's values add apply to the appropriate
// chart in the Variability Chart
For( i=1, i<=N Rows(dtSum), i++,
	Report( varch[i] )[axisbox( 1 )] << Add Ref Line( dtSum:LSL[i], "Solid", "Dark Green", "Target", 1 );
	Report( varch[i] )[axisbox( 1 )] << Add Ref Line( dtSum:USL[i], "Solid", "Dark Green", "", 1 );
);
Jim
Highlighted
Tomer9w
Level I

Re: automatic SPEC limits in var. charts

Thanks for your answer! 

in order to advance my script even more- i would like to join my current table (with the data i'm willing to analyse) with another data table (SPEC limits) which is constant and never change.

The SPEC limits data table contains these columns: "Gas__TactrasFlowCheckF_", "LSL","TARGET","USL".

the first column "_" symbol represents the options for 1-14 differents gases with 4 types of flow setting for each gas. 

Joining the data to one table would make it easier than writing down every spec limit for each gas type.

 

The 2 data table share only 1 column "Gas__TactrasFlowCheckF" and i want the script to add 3 SPEC limits to my current table- for each row.

After joining the data table i would use the script in the first reply to generate var. charts for each gas flow with it's specific spec settings.

 

A second thing i would like to make is Bivariate plot: 

in the X axis i would place "Time", and for the Y axis : "Value". i would generate one plot for each flow setting.

i had hard time to add a reference lines ("LSL","TARGET","USL") to each plot.

 

I would much appreciate your help with this!

Thanks

Article Labels

    There are no labels assigned to this post.