안녕,
저는 시간 덩어리가 다른 "주기"로 나뉜 시계열 데이터를 가지고 있으며, 각 주기의 시작을 표시하는 참조 선을 만드는 방법을 찾고 있습니다. 저는 시도 간에 로컬 데이터 필터를 변경할 때 이러한 참조 선을 업데이트하고 싶습니다(주기는 다른 시도에 대해 다른 시간에 시작되기 때문입니다).
처음에는 로컬 데이터 필터를 사용하여 Make Row State Handler를 사용하여 로컬 데이터 필터의 변경 사항을 감지했습니다 . 그러나 로컬 데이터 필터에서 필요한 정보(즉, 필터링되는 시행착오—로컬 데이터 필터에서 Get Where Clause를 사용하여 근접했을 수도 있음)를 가져오는 방법을 알아낼 수 없었고 필터링되는 시행착오를 알 수 없었고 이를 통해 참조 라인을 만드는 데 사용할 사이클 시간을 지시할 수 없었습니다. (그러나 이것이 더 나은 방법이라고 생각되면 알려주세요).
그래서 사용자가 로컬 데이터 필터와 상호 작용하여 필터를 읽어 필터링된 시험을 가져오는 대신, 사용자에게 시험 목록을 제공한 다음 사용자가 선택한 시험에 따라 필터를 추가하고, 동시에 선택 항목을 사용하여 참조 선을 만드는 데 사용할 사이클 시간을 지정하기로 했습니다.
그러나 사용자가 다른 체험판 번호를 선택할 때 변경되는 참조 행을 추가할 수 없습니다.
아래에서 제 코드를 확인하세요.
//Reference Lines that Update With Change in Local Data Filter
// Example Data
dt = New Table( "Example",
Add Rows( 3 ),
New Column( "Trial",
character,
"Ordinal",
Set Values( {"A","A","A","A","A","A","A","A","A","A","A","A","A","A","B","B","B","B","B","B","B","B","B","B","B","B","B","B"} )
),
New Column( "Cycle",
Character,
"Ordinal",
Set Values( {"Rinse","Rinse","Rinse","Wash","Wash","Wash","Wash","FinalRinse","FinalRinse","FinalRinse","FinalRinse","Dry","Dry","Dry","Rinse","Rinse","Rinse","Wash","Wash","Wash","Wash","FinalRinse","FinalRinse","FinalRinse","FinalRinse","Dry","Dry","Dry
"} )
),
New Column( "%Clean",
Numeric,
"Continuous",
Set Values( {10,20,25,50,60,70,80,85,90,95,99,99,99,99,10,25,30,60,75,85,90,95,99,99.9,99.99,99.99,99.99,99.99} )
),
New Column( "Time",
Numeric,
"Continuous",
Set Values( {1,2,3,4,5,6,7,8,9,10,11,12,13,14,2,4,6,8,10,12,14,16,18,20,22,24,26,28} )
),
);
dt = current data table();
//Function to pull cycle start times (where reference lines will be drawn)
genRefLineValue = function({trialNum = "A", cycleNum = "Rinse"},{myrows,myvalues,min_value},
myrows = dt << get rows where(and(:Trial == trialNum,:Cycle == cycleNum));
myvalues = :Time[myrows];
min_value = min(myvalues);
Return(min_value);
);
//Function to pull unique cycles (I want the start time for EACH of the cycles)
findUniqueCycles = function({trialNum},{myrows,cycles,uniqueCycles},
myrows = dt << get rows where(:Trial == trialNum);
cycles = :Cycle[myrows];
uniqueCycles = associative array(cycles) << get keys;
return(uniqueCycles);
);
//Get unique trials (A, B, etc.)
summarize(unique_values=by(:Trial));
//Create window with radio buttons and graph
New Window( "Example",
HListBox(
PanelBox("Trial", //Adding radio buttons
rb = radio box(
unique_values, <<SET></SET>
At the bottom is where I add the reference lines. If you run the script and select between Trial A and B, you can see that while the filter's working and the data changes accordingly, the reference lines don't change (it might look like they change, but if you observe the actual values, they aren't changing). I've tried using <EM>나의 선택</EM> in place of "A" so that the arguments in the loop that is creating the reference lines should update when the user selects Trial B:
<CODE class=" language-jsl">For(i=1,i<= (n items (findUniqueCycles(myChoice))),i++,
cycleName = findUniqueCycles(myChoice)[i];
cycleStart = genRefLineValue(myChoice,findUniqueCycles(myChoice)[i]);
report(biv)[axisbox(2)] << add ref line(cycleStart,"solid",,cycleName ||"(t="||char(cycleStart)||" min)",1.5);
);
But JMP complains by saying:
Name Unresolved: myChoice{3} in access or evaluation of 'myChoice' , myChoice/*###*/How do I make reference lines that update when the user changes their selection among trials?
Thanks in advance!
거의 다 왔다고 생각합니다.
코드의 뒷부분을 이것으로 바꾸십시오.
rb << Set Function(
Function( {this},{myChoice},
myChoice = Char( this << get selected );
(this << sib) << Set Text( myChoice );
//print(myChoice);
biv << remove local data filter;
biv << Local Data Filter(invisible, //updating (by removing then re-adding) the local data filter according to user's selection
Add Filter(
columns( :Trial ),
Where( :Trial == myChoice ),
));
if (myChoice == "A",
For(i=1,i<= (n items (findUniqueCycles("B"))),i++,
cycleStart = genRefLineValue("B",findUniqueCycles("B")[i]);
report(biv)[axisbox(2)] << remove ref line(cycleStart);
)
);
if (myChoice == "B",
For(i=1,i<= (n items (findUniqueCycles("A"))),i++,
cycleStart = genRefLineValue("A",findUniqueCycles("A")[i]);
report(biv)[axisbox(2)] << remove ref line(cycleStart);
)
);
For(i=1,i<= (n items (findUniqueCycles(myChoice))),i++,
cycleName = findUniqueCycles(myChoice)[i];
cycleStart = genRefLineValue(myChoice,findUniqueCycles(myChoice)[i]);
report(biv)[axisbox(2)] << add ref line(cycleStart,"solid",,cycleName ||"(t="||char(cycleStart)||" min)",1.5);
);
)
);
report(biv)[framebox(1)] << Frame Size( 1000, 400 );
//you need this to initialize somehow
For(i=1,i<= (n items (findUniqueCycles("A"))),i++,
cycleName = findUniqueCycles("A")[i];
cycleStart = genRefLineValue("A",findUniqueCycles("A")[i]);
report(biv)[axisbox(2)] << add ref line(cycleStart,"solid",,cycleName ||"(t="||char(cycleStart)||" min)",1.5);
);
또한 이 오류는 myChoice를 찾을 수 없거나 정의 해제할 수 없음을 의미합니다. 이는 콜백 내부에 있는 사용 가능한 곳 외부에서 사용했기 때문입니다.