안녕하세요,
저는 연속 데이터를 가지고 있는 변동성 차트를 작업하고 있는데, 저는 하위 그룹별로 플로팅하고 있습니다. 저는 "1C~13C", "16C~28C", "30C~45C"의 3개 온도 대역의 데이터를 가지고 있습니다. 저는 데이터에서 선택한 각 필터 범주에 대한 참조선을 그리려고 합니다. 3개의 다른 참조선 그룹이 있습니다.
첨부 파일과 가변성 스크립트를 참조하세요.
저는 스크립팅에 비교적 초보입니다. JMP 스크립팅 명령을 사용하면 각 참조 라인에 대한 명령을 작성할 수 있다는 것을 보았습니다. 데이터 필터에서 선택한 내용에 따라 명령을 동적으로 만들고 싶습니다. (스크립트의 굵은 밑줄이 그어진 섹션)
조언 부탁드립니다.
감사해요
매트
New Window( "Sample set 1 - Variability Chart by Lot",
V List Box(
Variability Chart(
Y( :Test 1 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) ),
SendToReport(
Dispatch(
{"Variability Chart for Test 1"},
"2",
ScaleBox,
{Min( 0.814090277777778 ), Max( 1.13166666666667 ), Inc( 0.05 ),
Minor Ticks( 1 ), Add Ref Line(
0, "Dotted", "Medium Light Gray", "", 1
), Add Ref Line( <U><STRONG>1.1</STRONG></U>, "Solid", "Black", "", 1 ),
Add Ref Line(<U> <STRONG>0.9</STRONG></U>, "Solid", "Black", "", 1 )}
)
)
),
Variability Chart(
Y( :Test 2 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
),
Variability Chart(
Y( :Test3 ),
X( :Lot ),
Std Dev Chart( 0 ),
Local Data Filter( Add Filter( columns( :Temp Band 2 ) ) )
)
)
)
안녕 @mcastner , 스크립팅을 시작하기 위해 상당히 복잡한 작업을 선택했다고 말할 수 있습니다!다음은 질문하신 대로 하는 방법입니다(제가 올바르게 해석했다면). 하지만 그래프 빌더를 사용하여 상자 플롯과 선을 동시에 그리는 것으로 이것을 쉽게 만들 수 있는지 궁금합니다.참조선에 대한 값은 어떻게 얻습니까?사용 가능한 데이터(중앙값, 분위수 등)의 요약이거나 공식 열에서 수행할 수 있습니까?
Names default to here(1);
dt = Open( "$Sample_data/big class.jmp" );
//Valeus for ref lines - hopefully populated by your script
reflines = Associative Array({
{"height",
Associative Array({
{ 12, 62 },
{ 13, 63 },
{ 14, 64 },
{ 15, 65 },
{ 16, 66 },
{ 17, 67 }
})
},
{"weight",
Associative Array({
{ 12, 112 },
{ 13, 113 },
{ 14, 114 },
{ 15, 115 },
{ 16, 116 },
{ 17, 117 }
})
}
});
//A window with a single data filter that will be applied to all graphs inside it
New Window("charts",
Data Filter Context Box(
H List Box(
ldf = dt << Data Filter( Local,
Add Filter(
columns( :age ),
Where( :age == 13 ),
Display( :age, N Items( 6 ) )
),
Mode( Select( 0 ), Show( 1 ), Include( 1 ) )
),
vc1 = Variability Chart(
Y( :height ),
X( :sex )
);
vc2 = Variability Chart(
Y( :weight ),
X( :sex )
);
)
)
);
//Function that is called when data filter changes and when the window is first opened, this will redraw lines on charts
UpdateRefLines = function({},
//find out what ages were selected, there is probably a better way to do this too
filteredagelast = filteredage;
filteredage = median(dt:age[ldf << get filtered rows()]);
//detect if there was a change in the age (prevents flickering of the screen)
if(is missing(filteredagelast) | (filteredagelast != filteredage),
//remove any existing ref lines
(vc1 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
(vc2 << XPath("//AxisBox[@charID=2]"))[1] << Revert Axis;
//draw new lines
(vc1 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["height"][FilteredAge], "Solid", "Black", "", 1 );
(vc2 << XPath("//ScaleBox[@ID=2]")) << Add Ref Line( reflines["weight"][FilteredAge], "Solid", "Black", "", 1 );
)
);
//function called when data filter changes, here it only redraws reference lines
UpdatesOnRowStateChanges = function({x}, if(is matrix(x), UpdateRefLines ) );
//variable used to keep track of the last filter applied
filteredage = .;
//Assign function to data filter
rsh = vc1 << Make Row State Handler( dt, UpdatesOnRowStateChanges );
//draw initial reference lines
UpdateRefLines();
