그러면 다른 접근 방식을 사용해야 합니다. 응답 한계는 하한, 중간, 상한만 지원합니다.
다음은 귀하가 제공한 데이터 테이블과 함께 작동하여 모든 참조선을 표시하는 간단한 스크립트입니다.
Names Default To Here( 1 );
dtMain = Data Table( "Main" );
dtLimits = Data Table( "Limits" );
// Get the columns to create box plots for
boxPlotList = dtMain << get column names( string, numeric );
// Get the columns that contain limits
refLineList = dtLimits << get column names( string, numeric );
// Loop across the box plot columns and generate the box plots
For( i = 1, i <= N Items( boxPlotList ), i++,
ow = Oneway( Y( Column( boxPlotList[i] ) ), X( :Player ), Box Plots( 1 ) );
// Find out if any reference line references are specified for the current
// box plot column
refLineMatrix = dtLimits << get rows where( :game == boxPlotList[i] );
// If references are found, then loop across the columns and rows in the Limits table
// and add the reference lines
If( N Rows( refLineMatrix ) > 0,
For( refRow = 1, refRow <= N Rows( refLineMatrix ), refRow++,
For( refCol = 1, refCol <= N Items( refLineList ), refCol++,
refLineValue = Column( dtLimits, refLineList[refCol] )[refRow];
Report( ow )[AxisBox( 1 )] << Add Ref Line( refLineValue, "Solid", "Black", "", 1 );
)
)
);
);
다음은 첫 번째 항목에 표시된 2개의 데이터 테이블을 먼저 생성한 다음, 한도 테이블에서 한도를 복사하여 기본 테이블의 각 열에 적용하는 코드를 생성하는 스크립트입니다.
Names Default To Here( 1 );
dtMain = New Table( "Main",
Add Rows( 20 ),
New Column( "Player",
Character,
"Nominal",
Set Values(
{"a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "b", "b", "b", "b", "b", "b", "b", "b", "b", "b"}
)
),
New Column( "Zone",
Character,
"Nominal",
Set Values(
{"North", "North", "North", "North", "North", "North", "North", "North", "North", "North", "South",
"South", "South", "South", "South", "South", "South", "South", "South", "South"}
)
),
New Column( "Badminton",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 3, 4, 5, 2, 4, 4, 4, 9, 5, 1, 2, 4, 3, 6, 2, 5, 6, 7, 6] )
),
New Column( "Table Tennis",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [2, 6, 6, 2, 5, 5, 3, 5, 7, 0, 3, 4, 7, 6, 4, 2, 8, 5, 2, 4] )
),
New Column( "Lawn Tennis",
Numeric,
"Continuous",
Format( "Best", 12 ),
Set Values( [3, 3, 5, 2, 6, 6, 6, 2, 6, 5, 7, 7, 8, 3, 5, 2, 6, 2, 3, 6] )
)
);
dtLimits = New Table( "Limits",
Add Rows( 3 ),
New Column( "Game",
Character,
"Nominal",
Set Values( {"Badminton", "Table Tennis", "Lawn Tennis"} ),
Set Display Width( 128 )
),
New Column( "Reference Line 1", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [7, 8, 6] ) ),
New Column( "Reference Line 2", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3] ) )
);
// Here is the code that sets the Response Limits
For( i = 1, i <= N Rows( dtLimits ), i++,
If( Try( (Column( dtMain, (Column( dtLimits, "Game" )[i]) )) << get name, "" ) != "",
Eval(
Substitute(
Expr(
Column( dtMain, Column( dtLimits, "Game" )[i] ) << set property(
"response limits",
{Goal( Maximize ), Lower( __Low__, 1 ), Upper( __up__, 1 ), Importance( 1 ),
Show Limits( 1 )}
)
),
Expr( __Low__ ), dtLimits:Reference Line 2[i],
Expr( __Up__ ),
dtLimits:Reference Line 1[i]
)
)
)
);