그래프 상자: 생성 후에도 변수 값이 계속 변경됩니다.[JMP 19] In the following script, I am trying to create a series of graph boxes that are displayed below each other in a window. For this i am given a list of values for every important characteristic (these lists are all accessible via the Associative Array 'listMap'. Then I create all graph boxes via a for loop.
This however doesn't work because the variables that are used inside of the Graph Box (i.a. iV, listMap<SPAN class="token punctuation">[</SPAN><SPAN class="token string">"중앙값"</SPAN><SPAN class="token punctuation">]</SPAN><SPAN class="token punctuation">[</SPAN>iV<SPAN class="token punctuation">]</SPAN>, numReferenceLines) also change the already created Graph Boxes that use them.
Is there a way to fixate the variables in a Graph Box? I want them to be evaluated instantly and then to not be able to be changed.
Disclaimer: According to my trials, 'Eval' doesn't seem to help. Neither do Namespaces (as they also still update, even if locked) or Journals (even if 'Freeze All' is activated).
어떤 도움이라도 감사히 받겠습니다. 미리 감사드립니다 
ClearGlobals();
NamesDefaultToHere( 1 );
width = 1600;
height = 900;
boxPlotWidth = 0.5;
v = 3;
listMap = Associative Array();
listMap["frameHeightMin"] = {0.5, 0.3, 0.4};
listMap["frameHeightMax"] = {1.5, 2.0, 4.1};
listMap["numReferenceLines"] = {3 , 5 , 8 };
listMap["min"] = {0.6, 0.6, 0.5};
listMap["median"] = {0.9, 1.4, 2.6};
listMap["max"] = {1.3, 1.7, 3.9};
win = New Window("Test");
For(iV = 1, iV <= v, iV++,
numReferenceLines = listMap["numReferenceLines"][iV];
frameHeightMin = listMap["frameHeightMin"][iV];
frameHeightMax = listMap["frameHeightMax"][iV];
win << Graph Box(
Frame Size( width, height ),
X Scale( 0, 2),
Y Scale( frameHeightMin, frameHeightMax ),
X Name("split"),
Y Name("values"),
//[] Generate grey horizontal lines
For(h = 0, h <= numReferenceLines, h++, HLine(frameHeightMin + (h/(numReferenceLines)*(frameHeightMax - frameHeightMin)))),
//[] Min
If(Contains(listMap, "min") & Contains(listMap, "min"),
Line({1 - boxPlotWidth/2, listMap["min"][iV] }, {1 + boxPlotWidth/2, listMap["min"][iV] }));
//[] Median
If(Contains(listMap, "median") & Contains(listMap, "median"),
Line({1 - boxPlotWidth/2, listMap["median"][iV]}, {1 + boxPlotWidth/2, listMap["median"][iV] }));
//[] Max
If(Contains(listMap, "max") & Contains(listMap, "max"),
Line({1 - boxPlotWidth/2, listMap["max"][iV] }, {1 + boxPlotWidth/2, listMap["max"][iV] }));
);
);
자동화 및 스크립팅데이터 탐색 및 시각화제목: 그래프 상자 관련 문제: 생성 후에도 변수 값이 계속 변경됨EvalExpr() 또는 Substitute() with Eval() 함수를 사용하여 그래프 상자의 값을 평가하십시오.
Names Default To Here(1);
width = 1600;
height = 900;
boxPlotWidth = 0.5;
v = 3;
listMap = Associative Array();
listMap["frameHeightMin"] = {0.5, 0.3, 0.4};
listMap["frameHeightMax"] = {1.5, 2.0, 4.1};
listMap["numReferenceLines"] = {3, 5, 8};
listMap["min"] = {0.6, 0.6, 0.5};
listMap["median"] = {0.9, 1.4, 2.6};
listMap["max"] = {1.3, 1.7, 3.9};
win = New Window("Test");
For(iV = 1, iV <= v, iV++,
numReferenceLines = listMap["numReferenceLines"][iV];
frameHeightMin = listMap["frameHeightMin"][iV];
frameHeightMax = listMap["frameHeightMax"][iV];
Eval(EvalExpr(
win << Append(Graph Box(
Frame Size(width, height),
X Scale(0, 2),
Y Scale(frameHeightMin, frameHeightMax),
X Name("split"),
Y Name("values"),
Line({1 - Expr(boxPlotWidth) / 2, Expr(listMap["min"][iV])}, {1 + Expr(boxPlotWidth) / 2, Expr(listMap["min"][iV])});
));
));
);
고려해야 할 변수가 너무 많기 때문에 대체품을 선택하는 것이 더 나은 방법일 가능성이 높습니다.
제목: 그래프 상자 관련 문제: 생성 후에도 변수 값이 계속 변경됨정말 감사합니다. 이 코드는 제게 잘 작동합니다. 그런데 "그래프 박스(...)" 안에 For 루프를 사용해야 하는 경우에도 이 방법을 적용할 수 있는지 아시나요? 아래 코드는 이전 예제를 기반으로 하지만, 각 박스플롯에 대해 여러 값을 포함하고 있습니다.
Names Default To Here(1);
width = 1600;
height = 900;
boxPlotWidth = 0.5;
v = 3; // number of canvas'
n = 2; // number of boxplots per canvas
listMap = Associative Array();
listMap["frameHeightMin"] = {0.5, 0.3, 0.4};
listMap["frameHeightMax"] = {1.5, 2.0, 4.1};
listMap["numReferenceLines"] = {3, 5, 8};
listMap["min"] = {{0.7, 0.6}, {0.4, 0.6}, {0.7, 0.5}};
listMap["median"] = {{0.9, 0.9}, {1.3, 1.4}, {3.0, 2.6}};
listMap["max"] = {{1.4, 1.3}, {1.8, 1.7}, {3.8, 3.9}};
win = New Window("Test");
For(iV = 1, iV <= v, iV++,
numReferenceLines = listMap["numReferenceLines"][iV];
frameHeightMin = listMap["frameHeightMin"][iV];
frameHeightMax = listMap["frameHeightMax"][iV];
Eval(EvalExpr(
win << Append(Graph Box(
Frame Size(width, height),
X Scale(0, n + 1),
Y Scale(frameHeightMin, frameHeightMax),
X Name("split"),
Y Name("values"),
For(iN = 1, iN <= n, iN++,
Line({iN - Expr(boxPlotWidth) / 2, Expr(listMap["min"][iV][iN])}, {iN + Expr(boxPlotWidth) / 2, Expr(listMap["min"][iV][iN])});
Line({iN - Expr(boxPlotWidth) / 2, Expr(listMap["median"][iV][iN])}, {iN + Expr(boxPlotWidth) / 2, Expr(listMap["median"][iV][iN])});
Line({iN - Expr(boxPlotWidth) / 2, Expr(listMap["max"][iV][iN])}, {iN + Expr(boxPlotWidth) / 2, Expr(listMap["max"][iV][iN])});
)
));
));
);
이 코드를 실행하려고 하면 항상 "이름을 확인할 수 없습니다: 'iN'에 대한 접근 또는 평가에서 iN이 확인되지 않았습니다. iN/*###*/이름을 확인할 수 없습니다: 'iN'에 대한 접근 또는 평가에서 iN이 확인되지 않았습니다. iN/*###*/"라는 오류가 발생합니다.
이 방법을 더 잘 아신다면 정말 감사하겠습니다 (:
참고로, Eval, EvalExpr, Expr이 실제로 어떻게 작동하는지 알아볼 수 있는 웹사이트나 포럼 게시물 등이 있을까요?
제목: 그래프 상자 관련 문제: 생성 후에도 변수 값이 계속 변경됨보통 저는 GraphBox 내부에서 값을 평가하여 For 루프 등에서 더 쉽게 접근할 수 있도록 합니다. 이 PDF 파일 , 스크립팅 가이드 , 스크립팅 색인(JMP 내) 및 JMP 커뮤니티는 모두 훌륭한 참고 자료입니다.
또한 이러한 기능들을 테스트할 때 이해하기 쉽도록 훨씬 더 간단한 것을 구현해 보는 것을 제안합니다.
Names Default To Here(1);
width = 1600;
height = 900;
linecount = 3;
linesx = {1, 2, 3};
linesy = {4, 6, 8};
nw = New Window("",
vlb = V List Box();
);
Eval(EvalExpr(
vlb << Append(Graph Box(
Frame Size(width, height),
X Scale(0, 10),
Y Scale(0, 10),
X Name("split"),
Y Name("values"),
ngb = Expr(linecount);
xs = Expr(linesx);
ys = Expr(linesy);
For(i = 1, i <= ngb, i++,
H Line(xs[i]);
V Line(ys[i]);
);
));
));