JSL - 動態圖表圖例變化大家好,
我正在使用下面的代碼來更改每個單選框用戶選擇的雙維圖表中的圖例和样條線。
樣條部分工作正常,但圖例不會改變:(
有任何想法嗎?

//Begin Script;
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
variables = {"age", "sex"};
// Initial nlevels is the number of levels of 'age', as it is the first by-group used.
nlevels=6;
// Creating the legend. For each selection, the previous spline fits are removed, then
// new ones are generated.
BC_legend = Panel Box( "Choose Legend",
legend = Radio Box(
{"age", "sex"},
fitVar = legend << Get Selected;
Match( fitVar,
"age",
(Summarize(vals = By( :age ), c=count );
For(ii = 1, ii <=nlevels, ii++,
obj << (Curve[1] << Remove Fit );
);
obj << Group By( :age ) << Fit Spline( 0.1, standardized );
nlevels = nItems(vals);
),
"sex",
(Summarize(vals = By( :sex ), c=count );
For(ii = 1, ii <=nlevels, ii++,
obj << (Curve[1] << Remove Fit );
);
obj << Group By( :sex ) << Fit Spline( 0.1, standardized );
nlevels = nItems(vals); )
);
));
// Fitting the initial Bivariate fit with 'age' as the by-group, adding the legend
// to control the selections.
nw = New Window( "BigClassBivariate",
HListBox(
obj = dt << Bivariate(
Y( :weight ),
X( :height ),
Group By( :age ),
Fit Spline( 0.1, standardized ),
SendToReport(
Dispatch(
{},
"Bivar Plot",
FrameBox,
{Frame Size( 493, 354 ),Marker Size( 2 ), Marker Drawing Mode( "Normal" ), Row Legend(
dt:(fitVar),
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "Standard" ),
Continuous Scale( Cont ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
); ,
BC_legend
));
//End Script;
回复:JSL - 動態圖表圖例更改我想我找到了一種在可變性圖表上運行它的方法。
如果我想要帶有動態圖例的多個(使用:***)可變性圖表,需要添加什麼?
//Begin Script;
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
variables = {"age", "sex"};
// Initial nlevels is the number of levels of 'age', as it is the first by-group used.
fitVar = "age";
nlevels = 6;
// Creating the legend. For each selection, the previous spline fits are removed, then
// new ones are generated.
BC_legend = Panel Box( "Choose Legend",
legend = Radio Box(
{"age", "sex"},
fitVar = legend << Get Selected;
Match( fitVar,
"age",
(Summarize( vals = By( :age ), c = count ) ; Report( obj )[Border Box( 2 )] << Delete ;
Report( obj )[FrameBox( 1 )] << Row Legend( "age", color( 1 ), Marker( 1 ) ) ;
// obj << Group By( :sex );
nlevels = N Items( vals ) ; ;
),
"sex",
(Summarize( vals = By( :sex ), c = count ) ; Report( obj )[Border Box( 2 )] << Delete ;
Report( obj )[FrameBox( 1 )] << Row Legend( "sex", color( 1 ), Marker( 1 ) ) ;
// obj << Group By( :sex );
nlevels = N Items( vals ) ; )
);
)
);
// Fitting the initial Bivariate fit with 'age' as the by-group, adding the legend
// to control the selections.
nw = New Window( "BigClassBivariate",
H List Box(
obj = dt <<
Variability Chart(
Y( :weight ),
X( :height ),
Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
Connect Cell Means( 1 ),
Std Dev Chart( 0 ),
Points Jittered( 1 ),
SendToReport(
Dispatch(
{},
"Variability Chart",
FrameBox,
{Marker Size( 8 ), Marker Drawing Mode( "Normal" ) ;
Row Legend(
dt:(fitVar),
Color( 1 ),
Color Theme( "JMP Default" ),
Marker( 0 ),
Marker Theme( "Classic" ),
Continuous Scale( Cont ),
Reverse Scale( 0 ),
Excluded Rows( 0 )
)}
)
)
),
BC_legend
)
);
//End Script;
回复:JSL - 動態圖表圖例更改嗨偉大的腳本
我如何在簡單的可變性圖表上使用這個腳本?
最佳 R
宜蘭
回复:JSL - 動態圖表圖例更改@RB ,
您的腳本必須刪除和添加圖例。 另外,我認為從最後一個到第一個刪除項目更安全。
附上2個腳本:
- DynamicChartLegend_Working.jsl 對您的腳本進行了一些更改。
- DynamicChartLegend_Generic.jsl 進行了更多更改,因此您不必為每個變量使用“千篇一律”代碼。 這是通過使用引用變量以及創建和使用函數 GetLevels() 來完成的。
您沒有提及您當前使用的 JMP 版本。 如果這些腳本不起作用,請提供有關 JMP 版本的信息。