Wie kann man Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Alle,
Ich kann dieses Problem nicht verstehen:
Ich muss meinen GB-Plots Handles hinzufügen. Ich habe mehrere GB-Plots in einem Fenster. Die Variablen im Handle-Skript interagieren. Ich muss entweder in jedem Skript neue Variablen verwenden oder für jedes Grafikskript einen neuen Namespace erstellen (das scheint mir die beste Lösung zu sein). Sobald ich einen Namespace erstellt habe, adressiere ich ihn jedoch über eine Referenzvariable, die bei jedem neuen Namespace überschrieben wird.
Im folgenden Beispiel verwende ich einfach andere Variablennamen, aber es muss dynamisch erstellt und richtig angesprochen werden.
Ich erinnere mich, dass es einen Trick gab, bei dem man etwa Folgendes verwendete:
ns = Namespace( Expr( ns << Get Name ) )
aber ich bin nicht sicher, ob es in diesem Fall anwendbar ist, und ehrlich gesagt bin ich nicht sicher, ob ich verstehe, wie und warum es dort funktioniert, wo ich es derzeit verwende.
Hier ist ein Beispielskript:
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);
Automatisierung und SkriptingBetreff: Wie kann ich Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Ich denke, Sie könnten (in diesem Fall) einfach Namespaces überspringen und Context Box verwenden
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);
Betreff: Wie kann ich Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Wenn ich diese GBs also dynamisch erstelle und sie zu meiner Line-Up-Box hinzufüge, sollte diese Kontextbox Variablen in sich selbst isolieren, genau wie {Default Local} dies innerhalb einer Funktion tut? Lassen Sie mich das versuchen.
Betreff: Wie kann ich Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Nein, funktioniert nicht. Die Griffe verhalten sich nicht unabhängig voneinander. Ich bewege den Griff auf Plot 1, sobald ich auf den Griff auf Plot 2 klicke, springt er an die Stelle, an der sich der Griff auf Plot 1 befindet.
Hier ist das Skript:
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 );
Betreff: Wie kann ich Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Vergleichen Sie unsere Skripte und Sie werden mit Sicherheit einen Unterschied bemerken (nur die Context Box zu haben, reicht nicht aus, Sie müssen sie auch nutzen).
Betreff: Wie kann ich Namespaces dynamisch erstellen und adressieren? Unabhängige Handles auf mehreren GB-Plots.Ups, Entschuldigung ...:) Mein Fehler:)
Wenn es richtig geschrieben ist, funktioniert es. Vielen Dank!