안녕하세요, 저는 jmp 스크립팅 언어를 처음 접했습니다. 아래 코드는 작동하지만(3~n열의 막대 그래프를 표시함) 제가 하고 싶은 일이 한 가지 있습니다. 내 출력이 모든 열의 누적 막대 차트가 되도록 스크립트를 작성하려면 어떻게 해야 합니까?
for(i=3,i<=NItems(colList2),i++,
기가바이트= dt4 << 그래프 빌더(
크기(534,454),
제어판 표시(0),
변수(
X(:Label),Y(eval(Column(dt4,colList2[i]))),
),
요소(막대(X,Y))
)));
다양한 수의 들어오는 Y 열을 포함하도록 확장할 수 있는 단일 명령문은 없습니다.따라서 기본 형태를 취하고, 컬럼 수에 따라 동적으로 생성해야 합니다.
기본 형태는 이렇습니다
Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables(
X( :SITE ),
Y( :NPN1 ),
Y( :PNP1, Position( 1 ) ),
Y( :PNP2, Position( 1 ) ),
Y( :NPN2, Position( 1 ) ),
Y( :PNP3, Position( 1 ) )
),
Elements(
Bar(
X,
Y( 1 ),
Y( 2 ),
Y( 3 ),
Y( 4 ),
Y( 5 ),
Legend( 4 ),
Bar Style( "Stacked" )
)
)
);
다음은 누적 막대 차트를 동적으로 작성하는 예제 스크립트입니다.
names default to here(1);
dt=open("$SAMPLE_DATA/Blood Pressure.jmp");
// Get all of the continuous data columns
colList = dt << get column names(continuous,string);
// Create the JSL to create the script
theExpr = "Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables(
X( :Dose ),";
// Add the first Y entry
theExpr = theExpr || "Y( :" || colList[1] || " )";
// Add the remaining Y entries
For( i=2, i<= n items(colList), i++,
theExpr = theExpr || ", Y( :" || colList[i] || ", Position( 1 ) )";
);
// Finish up the Variables list, and start the Elements
theExpr = theExpr || "), Elements( Bar(X, Y( 1 )";
// Add the remaining Y elements
For( i=2, i<= n items(colList), i++,
theExpr = theExpr || ", Y( " || char(i) || " )";
);
// Finish up the required specifications
theExpr = theExpr || ",
Legend( 4 ),
Bar Style( \!"Stacked\!" )
)
)
);";
// Run the created JSL
eval(parse(theExpr));
생산하는

답장을 보내주셔서 감사합니다! 그래프 빌더를 대화형으로 사용하지 않고도 스크립트가 다른 열 이름을 가진 다른 데이터 세트에서 스크립트를 자동으로 실행하도록 하려면 어떻게 해야 하는지 아시나요?
@txnelson 썼다:
대화식으로 그래프 빌더로 이동하여 원하는 모양으로 그래프를 개발한 다음 빨간색 삼각형으로 이동하여 "스크립트 저장"을 선택하면 됩니다. JMP가 JSL을 생성합니다.