707228_ko-KR
변수 모델링 유형에 따라 그래프 빌더 차트 유형을 동적으로 변경

이 레시피는 사용자가 열 전환기에서 연속형 또는 범주형 x축 변수를 선택하는지 여부에 따라 그래프 빌더에서 요소 유형을 동적으로 변경하는 방법을 보여줍니다. 요소는 그래프 빌더 팔레트 상단에 아이콘으로 표시되는 그래프 유형입니다. 연속 입력의 경우 사용자가 맞춤선과 윤곽선 중에서 선택할 수 있는 라디오 버튼이 추가되었습니다. 이 레시피는 JMP 전문가가 아니고 제한된 수의 옵션만 필요한 사람들을 위한 대화형 차트를 만들 때 유용합니다.
재료:샘플 데이터 테이블 - 대규모 클래스
난이도 - 어려움
단계- Start with 이름의 기본값은 여기에 있습니다(1) and open 큰 수업.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
- Create a function which sends a message to the 그래프 빌더 platform that removes the existing element then adds a new one. It assumes that the 포인트들 element is already displayed and is element number 1, therefore the element to be removed is number 2.
// This function changes the type of chart being displayed.
// It takes a reference to a Graph Builder report (gbr) and the chart type required (gr)
// At the moment it assumes the Points element will always be included
changeElement = function( {gbr, gr},
{default local},
Eval(
Substitute(
Expr(
gbr << remove element( 1, 1, 2 ) << add element( 1, 1, {Type( __aa__ ), X, Y} )
), Expr( __aa__ ), gr
)
)
);
- Create the new window which contains the column switcher (CS) to change the x-axis, a radio box (rb) to control the element type for continuous variables, and the Graph Builder (GB).
rb_out = "Line of Fit";
win1 = New Window( "Demo",
Text Box(
"Column switching between continuous and nominal variables will change line of fit to box plots",
<<SET wrap=""></SET>
<P>열 전환기는 그래프 빌더 외부에서 의도적으로 생성되므로 나중에 전환기가 변경될 때 조치를 취하는 함수를 생성할 수 있습니다.</P>
<OL start="6">
<LI>Link the column switcher <FONT face="courier new,courier">CS</FONT> to the Graph Builder <FONT face="courier new,courier">GB</FONT>
<PRE><CODE class=" language-jsl">cs << link platform( gb );
Create a Column Switch Handler. The function post is called by the handler once the change has been completed. The format comes directly from the Scripting Index.
post = Function( {previousColumn, currentColumn, switcher},
gbr = Report( gb )[GraphBuilderBox( 1 )];
If( Column( dt, cs << get current ) << get modeling type == "Continuous",
changeElement( gbr, rb_out ),
changeElement( gbr, "Box Plot" )
);
);
cs << Make Column Switch Handler( 1, post );
전환이 완료되기 전에는 아무 일도 일어나지 않으므로 Make Column Switch Handler 의 첫 번째 인수는 아무 작업도 수행하지 않습니다.
Finally, start the column switcher running for demo purposes.
cs << run();
잠재적인 변화:
- 그래프 빌더의 기존 요소를 반복하는 "사전" 변경 함수를 생성하고( << Get Elements 사용) 제거해야 하는 요소를 찾은 다음 << 요소 제거에 의존하는 대신 프로그래밍 방식으로 세 번째 인수를 설정합니다. 두 번째 요소임).
<LINGO-LABS id="lingo-labs-707228" slang="en-US" mode="UPDATE"><LINGO-LABEL>자동화 및 스크립팅</LINGO-LABEL><LINGO-LABEL>디저트</LINGO-LABEL></LINGO-LABS>
Comments
There are no comments yet