그래프와 동일한 대시보드의 메뉴에서 선택하여 Graph Builder에서 '색상( )'의 동적 업데이트JMP 커뮤니티 안녕하세요.
응용 프로그램을 생성하는 JMP 추가 기능으로 작업하고 있습니다. 이 애플리케이션에는 하나의 모듈만 있으며 여러 그래프가 포함된 대시보드를 생성합니다. 또한 동일한 대시보드에 포함되고 그래프를 생성하는 데 사용되는 데이터 테이블의 열 목록을 포함하는 표시 상자를 생성합니다. 목록에서 열을 선택하면 해당 선택에 따라 행 상태(구체적으로는 행 색상)가 업데이트됩니다. 그런 다음 행 상태에 따라 색상이 지정된 그래프에 반영됩니다. 그러나 그래프 빌더의 '색상( )' 변수가 아직 비어 있기 때문에 그래프의 범례가 표시되는 색상에 따라 업데이트되지 않습니다. 열 목록이 있는 표시 상자를 모달 창으로 표시하면 선택 항목에 따라 '색상( )' 필드를 채울 수 있습니다. ~ 전에 그래프가 생성됩니다. 하지만 이 접근 방식의 문제는 모달 창을 대시보드에 포함할 수 없고(또는 적어도 방법을 모른다) 더 중요한 것은 동적이지 않다는 것입니다. 선택은 한 번만 할 수 있습니다. 그래프가 생성되기 전에 시작하지만 추가 기능을 다시 실행하지 않고는 다른 선택을 할 수 없습니다. 내 코드에서 발췌한 내용을 포함했습니다. 'win' 개체는 열 목록이 있고 대시보드에 포함된 표시 상자입니다.
JMP App(
Set Name( "Application" ),
Set Description(
"An empty workspace for creating custom applications with one or more windows and scripts"
),
Auto Launch( 1 ),
Snap To Grid( 1 ),
Show Grid( 1 ),
Show Properties( 1 ),
Show Sources( 1 ),
Group By Category( 1 ),
Dashboard Mode( 0 ),
Parameters,
Tables,/*(
DataTable1 = GuiTable(
Set Path(
"/S:/17 - Contacts - Confidential material/Siemens/2018-08 - Bangkok test/05 - Analysis/All component compilation v6 (with Row column).jmp"
),
Set Label( "All component compilation v5" ),
Set Location( "Current Data Table" ),
Set Invisible( 0 )
)
),*/
Script(JSL Quote(// This script is executed when the application is run.
// Named objects have been created for the application modules
// (for example, "Module1") and the pre-defined object
// "thisApplication" refers to the application object itself.
// Variables and functions declared here are scoped to the
// Application namespace.
)),
Allocate(
Module1 = Plan(
PreAllocate,
Script(JSL Quote(// This script is executed when a new module instance is
// created. The pre-defined object "thisModuleInstance" refers
// to the instance object, but other objects such as boxes and
// scripts have not yet been created. Variables declared here are
// scoped to the ModuleInstance namespace.
// This special function will receive parameters passed to CreateInstance()
OnModuleLoad({});
dt = current data table(); //note that dt has to be defined before the thisModuleInstance' object is created. When defined after and the new "Row" column is added, the code does not recognise the new column and so outputs empty plots. This may be due to the namespaces: maybe the dt has to be in the application namespace and the after thisModuleInstance is created, it is in the module namespace.
If( Is Missing (Is Scriptable( Try ( Column( "Row" )))),
dt << New Column( "Row", Numeric, Values( 1 :: N Row() ), Format( "Best", 12 )));
colnames = dt << get column names;
thisModuleInstance << Create Objects;
// After this point your module instance objects have been created
// and can be referred to by name (for example, "Button1").
show(chosen);
)),
Allocate(
Outline1 = Outline Box();
DataFilterContext1 = Data Filter Context Box();
List1 = H List Box();
List2 = V List Box();
DataFilter1 = dt << Data Filter( Local );
win = Platform(
dt,
H List Box(
Panel Box( "Colour by:",
collist = List Box(
colnames,
max selected( 1 ),
chosen = collist << get selected;
col = column(chosen);
dt << Color or Mark by Column( col ),
)
)
)
);
List3 = V List Box();
List4 = H List Box();
Report1 = Platform(
dt,
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables( X( :Row ), Y( :Friction ) ),
Elements(
Points( X, Y, Legend( 9 ) ),
Smoother( X, Y, Legend( 10 ) )
),
)
);
Report2 = Platform(
dt,
Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables( X( :Row ), Y( :Velocity ) ),
Elements(
Points( X, Y, Legend( 6 ) ),
Smoother( X, Y, Legend( 7 ) )
)
)
);
여러분의 제안을 기다리겠습니다.
미리 감사드립니다!
제도법다른스크립팅Re: 그래프와 동일한 대시보드의 메뉴에서 선택하여 Graph Builder에서 '색상( )'이 동적으로 업데이트됩니다.@gzmorgan0 , 신속한 답변에 감사드립니다.
귀하의 솔루션이 효과가 있었으므로 그것도 감사합니다. 다른 사람의 이익을 위해 귀하의 솔루션을 내 필요에 맞게 조정한 방법을 아래 코드에서 보여줍니다.
JMP App(
Set Name( "Application" ),
Set Description(
"An empty workspace for creating custom applications with one or more windows and scripts"
),
Auto Launch( 1 ),
Snap To Grid( 1 ),
Show Grid( 1 ),
Show Properties( 1 ),
Show Sources( 1 ),
Group By Category( 1 ),
Dashboard Mode( 0 ),
Parameters,
Tables,/*(
DataTable1 = GuiTable(
Set Path(
"/S:/17 - Contacts - Confidential material/Siemens/2018-08 - Bangkok test/05 - Analysis/All component compilation v6 (with Row column).jmp"
),
Set Label( "All component compilation v5" ),
Set Location( "Current Data Table" ),
Set Invisible( 0 )
)
),*/
Script(JSL Quote(// This script is executed when the application is run.
// Named objects have been created for the application modules
// (for example, "Module1") and the pre-defined object
// "thisApplication" refers to the application object itself.
// Variables and functions declared here are scoped to the
// Application namespace.
)),
Allocate(
Module1 = Plan(
PreAllocate,
Script(JSL Quote(// This script is executed when a new module instance is
// created. The pre-defined object "thisModuleInstance" refers
// to the instance object, but other objects such as boxes and
// scripts have not yet been created. Variables declared here are
// scoped to the ModuleInstance namespace.
// This special function will receive parameters passed to CreateInstance()
OnModuleLoad({});
dt = current data table(); //note that dt has to be defined before the thisModuleInstance' object is created. When defined after and the new "Row" column is added, the code does not recognise the new column and so outputs empty plots. This may be due to the namespaces: maybe the dt has to be in the application namespace and the after thisModuleInstance is created, it is in the module namespace.
If( Is Missing (Is Scriptable( Try ( Column( "Row" )))),
dt << New Column( "Row", Numeric, Values( 1 :: N Row() ), Format( "Best", 12 )));
colnames = dt << get column names;
thisModuleInstance << Create Objects;
// After this point your module instance objects have been created
// and can be referred to by name (for example, "Button1").
)),
Allocate(
Outline1 = Outline Box();
DataFilterContext1 = Data Filter Context Box();
List1 = H List Box();
List2 = V List Box();
DataFilter1 = dt << Data Filter( Local );
win = Platform(
dt,
H List Box(
Panel Box( "Colour by:",
collist = List Box(
colnames,
max selected( 1 ),
if( chosen != "",
gbb1 << Remove Variable( {col, Role( "Color" )} );
gbb2 << Remove Variable( {col, Role( "Color" )} );
);
chosen = collist << get selected;
col = column(chosen);
dt << Color or Mark by Column( col );
gbb1 = Report( gb1 )[Graph Builder Box( 1 )];
gbb1 << Add Variable( {col, Role( "Color" )} );
gbb2 = Report( gb2 )[Graph Builder Box( 1 )];
gbb2 << Add Variable( {col, Role( "Color" )} );
)
)
)
);
List3 = V List Box();
List4 = H List Box();
Report1 = Platform(
dt,
gb1 = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables( X( :Row ), Y( :Friction ) ),
Elements(
Points( X, Y, Legend( 9 ) ),
Smoother( X, Y, Legend( 10 ) )
)
)
);
Report2 = Platform(
dt,
gb2 = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Fit to Window( "Maintain Aspect Ratio" ),
Variables( X( :Row ), Y( :Velocity ) ),
Elements(
Points( X, Y, Legend( 6 ) ),
Smoother( X, Y, Legend( 7 ) )
)
)
);다시 말하지만 위의 코드는 전체 코드에서 발췌한 것입니다. 위에서 볼 수 있듯이 새로운 선택이 이루어질 때마다 실행되는 'win' 플랫폼 내부에 gbb1과 gbb2를 정의해야 합니다. 이것은 속도 측면에서 최적이 아닐 수 있지만 코드가 작동하는 경우 정의할 수 있는 유일한 위치인 것 같습니다(이유는 잘 모르겠습니다).
다시 한번 감사드립니다 @gzmorgan0 .
Re: 그래프와 동일한 대시보드의 메뉴에서 선택하여 Graph Builder에서 '색상( )'이 동적으로 업데이트됩니다.@A_Zaid ,
당신은 말했다
" 그래프가 생성되기 전에 시작할 때 한 번만 선택할 수 있지만 추가 기능을 다시 실행하지 않고는 다른 선택을 할 수 없습니다. "
사실 그것은 우리 책의 정오표였습니다. GraphBuilderBox()에 메시지를 보내 변수를 추가하거나 제거할 수 있습니다. 아래 스크립트를 참조하십시오.
변수를 추가하거나 제거하려면 인터페이스를 추가해야 할 수 있습니다.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :height ), Y( :weight ) ),
Elements( Points( X, Y ), Smoother( X, Y ) )
);
gbb = Report( gb )[Graph Builder Box( 1 )];
Wait( 0.5 );
gbb << Add Variable( {:sex, Role( "Wrap" )} );
wait( 0.5 );
gbb << Add Variable( {:sex, Role( "Color" )} );
wait( 0.5 );
gbb << Remove Variable( {:sex, Role( "Color" )} );
wait( 0.5 );
gbb << Add Variable( {:age, Role( "Color" )} );