네임스페이스를 동적으로 생성하고 처리하는 방법은 무엇인가요? 여러 GB 플롯에 대한 독립적인 핸들을 사용합니다.모두,
나는 이 문제를 이해할 수 없습니다.
GB 플롯에 핸들을 추가해야 합니다. 한 창에 여러 개의 GB 플롯이 있는데, 핸들 스크립트의 변수들이 서로 충돌합니다. 각 스크립트에 새 변수를 사용하거나 각 그래픽 스크립트에 새 네임스페이스를 만들어야 합니다(제 생각에는 이 방법이 가장 적합해 보입니다). 하지만 네임스페이스를 생성하는 즉시 참조 변수를 통해 해당 네임스페이스를 참조하는데, 새 네임스페이스를 생성할 때마다 참조 변수가 덮어쓰기됩니다.
아래 예에서는 단지 서로 다른 변수 이름을 사용했지만, 이는 동적으로 생성되어야 하며 올바르게 처리되어야 합니다.
다음과 같은 것을 사용하는 몇 가지 요령이 있었던 걸 기억합니다.
ns = Namespace( Expr( ns << Get Name ) )
하지만 이 경우에 적용할 수 있는지 확신할 수 없고, 솔직히 말해서 현재 내가 사용하고 있는 곳에서 어떻게 그리고 왜 작동하는지 잘 모르겠습니다.
다음은 스크립트의 예입니다.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
lub = Lineup Box( N Col( 2 ) );
ns1 = New Namespace(
"height"
);
ns1:_x_location_ = 2;
ns1:_y_location_ = 50;
lub << Append(Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 6 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "" ),
Handle(
ns1:_x_location_,
ns1:_y_location_,
ns1:_x_location_ = x;
ns1:_y_location_ = y;
)
)}
)
)
);
);
ns2 = New Namespace(
"weight"
);
ns2:_x_location_ = 2;
ns2:_y_location_ = 50;
lub << Append(Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 6 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "" ),
Handle(
ns2:_x_location_,
ns2:_y_location_,
ns2:_x_location_ = x;
ns2:_y_location_ = y;
)
)}
)
)
);
);
win = New Window( "Independent Handles Example",lub);
자동화 및 스크립팅Re: 네임스페이스를 동적으로 생성하고 주소를 지정하는 방법? 여러 GB 플롯에 대한 독립적인 핸들.이 경우 네임스페이스를 건너뛰고 Context Box를 활용할 수 있다고 생각합니다.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
lub = Lineup Box(N Col(2));
lub << Append(
cb1 = Context Box(
box:_x_location_ = 2;
box:_y_location_ = 50;,
Graph Builder(
Size(528, 450),
Show Control Panel(0),
Variables(X(:age), Y(:height), Overlay(:sex)),
Elements(Points(X, Y, Legend(6))),
SendToReport(
Dispatch({}, "Graph Builder", FrameBox,
{Add Graphics Script(
2,
Description(""),
Handle(
box:_x_location_,
box:_y_location_,
box:_x_location_ = x;
box:_y_location_ = y;
)
)}
)
)
)
)
);
lub << Append(
cb2 = Context Box(
box:_x_location_ = 2;
box:_y_location_ = 50;,
Graph Builder(
Size(528, 450),
Show Control Panel(0),
Variables(X(:age), Y(:weight), Overlay(:sex)),
Elements(Points(X, Y, Legend(6))),
SendToReport(
Dispatch({}, "Graph Builder", FrameBox,
{Add Graphics Script(
2,
Description(""),
Handle(
box:_x_location_,
box:_y_location_,
box:_x_location_ = x;
box:_y_location_ = y;
)
)}
)
)
)
)
);
win = New Window("Independent Handles Example", lub);
Re: 네임스페이스를 동적으로 생성하고 주소를 지정하는 방법? 여러 GB 플롯에 대한 독립적인 핸들.그럼 제가 동적으로 이러한 GB를 생성해서 Line Up Box에 추가한다면, 이 Context Box는 {Default Local}이 함수 내부에서 하는 것처럼 자체 내부에서 변수를 격리해야 할까요? 한 번 시도해 보겠습니다.
Re: 네임스페이스를 동적으로 생성하고 주소를 지정하는 방법? 여러 GB 플롯에 대한 독립적인 핸들.아니요, 작동하지 않습니다. 핸들이 독립적으로 작동하지 않습니다. 플롯 1에서 핸들을 움직이면 플롯 2 핸들을 클릭하자마자 플롯 1의 핸들이 있는 위치로 이동합니다.
스크립트는 다음과 같습니다.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
lub = Lineup Box( N Col( 2 ) );
lub << Append(
Context Box(
_x_location_ = 2;
_y_location_ = 50;
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 6 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "" ),
Handle(
_x_location_,
_y_location_,
_x_location_ = x;
_y_location_ = y;
)
)}
)
)
);
)
);
lub << Append(
Context Box(
_x_location_ = 2;
_y_location_ = 50;
Graph Builder(
Size( 528, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 6 ) ) ),
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
{Add Graphics Script(
2,
Description( "" ),
Handle(
_x_location_,
_y_location_,
_x_location_ = x;
_y_location_ = y;
)
)}
)
)
);
)
);
win = New Window( "Independent Handles Example", lub );
Re: 네임스페이스를 동적으로 생성하고 주소를 지정하는 방법? 여러 GB 플롯에 대한 독립적인 핸들.우리의 스크립트를 비교해 보면 확실히 차이를 느낄 수 있을 겁니다(Context Box가 있는 것만으로는 충분하지 않고, 활용해야 합니다).
Re: 네임스페이스를 동적으로 생성하고 주소를 지정하는 방법? 여러 GB 플롯에 대한 독립적인 핸들.아, 미안해요...:) 내 잘못이야:)
올바르게 작성하면 작동합니다. 정말 감사합니다!