這是一個非常驚人的腳本。
您確定不能只是製作匯總表並從那裡繪圖。
在CCB中,您可以從表中加載限制。如果需要,可以製作一個匯總表,然後再製作一個極限表。從一個圖中繪製,從另一個圖中獲得極限,也許嗎?
在如下所示的同一JSL腳本中使用兩個Loop時,一種是通過不同的“ ToGraphBy”繪製雙變量圖表,另一種是為具有不同顏色的那些圖表添加Spline(通過“ Flag”)。但是,由於第二個循環從所有表而不是通過“ ToGraphBy”對每個分隔的段計數“標記”,這導致每個段圖表的點顏色與樣條線顏色不匹配。誰能幫助我們對該腳本進行一些大的修改以使其更合理?
dt = Current Data Table();
Summarize( dt, byVals = by( :TOGRAPHBY ) );
Summarize( dt, ByFlag = by(:Flag ) );
Bi = Bivariate( X( :LOT_DATA_COLLECT_DATE ), Y( :CHART_VALUE ), by( :TOGRAPHBY ));
For( i = 1, i <= N Items( byVals ), i++,
LCL = :LO_CONTROL_LMT[(dt << get rows where( :TOGRAPHBY == byVals[i] ))[1]];
UCL = :UP_CONTROL_LMT[(dt << get rows where( :TOGRAPHBY == byVals[i] ))[1]];
TGT = :TARGET[(dt << get rows where( :TOGRAPHBY == byVals[i] ))[1]];
chartMin = Min( :CHART_VALUE[dt << get rows where( :TOGRAPHBY == byVals[i])]);
chartMax = Max( :CHART_VALUE[dt << get rows where( :TOGRAPHBY == 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(
{:TOGRAPHBY == __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( 900, 600 ),Marker size (2), Row Legend(
Flag,
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
),
);
);
For( i = 1, i <= N Items( ByFlag ), i++,
bi << Fit Where(
:Flag == ByFlag[i],
Fit Spline( 1e16)
)
);
