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
yu629xiao
Level II

FIT Spline in Loop Function

I am using below loop function to create Bivariate charts by Column " MEASUREMENT_FLAG_NOCHAMBER". However , I want to add more FIT Spline grouping by " WLT_COMPONENT" but fail again and again. anybody can help check what I can do for below script ?

 

 

dt = Current Data Table();

Summarize( dt, byVals = by( :MEASUREMENT_FLAG_NOCHAMBER ) );

Bi = Bivariate( X( :LOT_DATA_COLLECT_DATE ), Y( :CHART_VALUE ), by( :MEASUREMENT_FLAG_NOCHAMBER ));

For( i = 1, i <= N Items( byVals ), i++,

LCL = :LO_CONTROL_LMT[(dt << get rows where( :MEASUREMENT_FLAG_NOCHAMBER == byVals[i] ))[1]];
UCL = :UP_CONTROL_LMT[(dt << get rows where( :MEASUREMENT_FLAG_NOCHAMBER == byVals[i] ))[1]];
TGT = :TARGET[(dt << get rows where( :MEASUREMENT_FLAG_NOCHAMBER == byVals[i] ))[1]];

chartMin = Min( :CHART_VALUE[dt << get rows where( :MEASUREMENT_FLAG_NOCHAMBER == byVals[i])]);
chartMax = Max( :CHART_VALUE[dt << get rows where( :MEASUREMENT_FLAG_NOCHAMBER == byVals[i])]);

If(LCL < chartMin, chartMin = LCL );
If(UCL > chartMax, chartMax = UCL );

chartRange5% = (chartMax - ChartMin)/5;
Gridset=(UCL - LCL)/5;

chartMin = chartMin - chartRange5%;
chartMax = chartMax + chartRange5%;

Eval(
Substitute(
Expr(
Bi << SendToByGroup(
{:MEASUREMENT_FLAG_NOCHAMBER == __byVals__},
SendToReport(
Dispatch(
{},
"1",
ScaleBox,
{Format( "y/m/d h:m:s", 22, 0 ), Min(),
Max( ), Interval( "Day" ), Inc( 1 ), Minor Ticks( 0 ),
Label Row( Label Orientation( "Vertical" ) )}
),
Dispatch(
{},
"2",
ScaleBox,
{Min( __min__ ), Max( __max__ ), Inc( __Grid__ ), Minor Ticks( 1 ), Label Row( Show Major Grid( 1 )),
Add Ref Line( __LCL__, "Solid", "Medium Dark Red", "LCL", 1 ),
Add Ref Line( __TAR__, "Solid", "Blue", "Target", 2 ),
Add Ref Line( __UCL__, "Solid", "Medium Dark Red", "UCL", 1 )}
),
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Frame Size( 850, 750 ),Row Legend(
WLT_COMPONENT,
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 1 ),
Marker Theme( "Standard" ),
Continuous Scale( 0 ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
)
),
Expr( __byVals__ ), byVals[i],
Expr( __UCL__ ), UCL,
Expr( __LCL__ ), LCL,
Expr( __min__ ), chartMin,
Expr( __max__ ), chartMax,
Expr( __Grid__ ), Gridset,
Expr( __TAR__ ), TGT
),
);
);

 

1 REPLY 1
Highlighted
Byron_JMP
Staff

Re: FIT Spline in Loop Function

maybe try making the graph manually the first time, like you are in the fitY by X platform.

Then from the red triangle menu, choose, "Group By" and select WLT_component.  

Save the script to the script window so you can get the JSL for adding the grouping variable top add to your script.

JMP Systems Engineer, Pharm and BioPharm Sciences
Article Labels

    There are no labels assigned to this post.