我在原始線程上發布了這個問題,但它可能沒有正確突出顯示,因此嘗試作為一個新帖子。
此連結中的程式碼看起來非常有用
如何在自訂視窗上建立呼叫按鈕 - JMP 用戶社區
然而,如何正確利用召回功能對我來說並不明顯。
我借用並修改了一些程式碼(如下),但缺乏回憶,我試圖弄清楚如何將它們焊接在一起。我很接近,但像往常一樣錯過了一些東西。感謝所有幫助。
dt = Current Data Table();
cd = Column Dialog(
exy = ColList( "Y", Min Col( 1 ) ),
exx = ColList( "X", Min Col( 1 ) )
);
Eval( cd[1] );
Eval( cd[2] );
yyy = Expr( y() );
xxx = Expr( x() );
xval = exx[1];
For( i = 1, i <= N Items( exy ), i++,
Insert Into( yyy, exy[i] )
);
For( i = 1, i <= N Items( exx ), i++,
Insert Into( xxx, exx[i] )
);
nw = New Window( "Annotated Multiple Plots",
For( i = 1, i <= N Items( exy ), i++,
Notes = exy[i] << Get Property( "Notes" );
Try(
Bivariate(
Y( exy[i] ),
X( exx[1] ),
SendToReport(
Dispatch(
{},
"",
AxisBox( 2 ),
Add Text Annotation(
Text( "Category: " || Notes ),
Fixed Size( 0 ),
Text Box( {-80, 25, 0, 50} ),
Filled( 0 )
)
)
)
)
);
)
);
謝謝
再見
扳手頭
再見,
以下是您的腳本與如何在自訂視窗上建立呼叫按鈕中引用的腳本的簡單組合。首先,您提供的範例使用 Column Dialog() ,而呼叫範例則使用新視窗作為使用者對話框。 JMP 已棄用“列對話框”,轉而使用“新視窗”。 您需要做的就是研究腳本並了解它是如何工作的。它帶來了一些需要一些理解的項目。命名空間是一個主要的空間。
Names Default To Here( 1 );
/* Assign dt to reference a table. Open a sample table for demonstration purposes */
dt = Open( "$SAMPLE_DATA/Semiconductor Capability.jmp" );
/* Use a named namespace to hold the recall values */
If( !Namespace Exists( "Custom Dialog" ), // define namespace if it does not exist
dialogRecallNS = New Namespace(
"Custom Dialog",
{
ycolRecall =
{
}
,
orderRecall =
{
}
,
byRecall =
{
}
}
)
, // else get a reference to the existing namespace
dialogRecallNS = Namespace( "Custom Dialog" )
);
nc = N Col( dt );
lbWidth = 130;
// The program to execute when the OK button is pressed
pgm = Expr(
nw = New Window( "Annotated Multiple Plots",
For( i = 1, i <= N Items( exy ), i++,
Notes = Try( exy[i] << Get Property( "Notes" ) );
Try(
Bivariate(
Y( exy[i] ),
X( exx[1] ),
SendToReport(
Dispatch( {}, "", AxisBox( 2 ),
Add Text Annotation(
Text( "Category: " || Notes ),
Fixed Size( 0 ),
Text Box( {-80, 25, 0, 50} ),
Filled( 0 )
)
)
)
)
);
)
)
);
/* Expression to clear all current settings */
clearRoles = Expr(
colListY << RemoveAll;
colListX << RemoveAll;
);
/* Expression to store the current settings in global variables */
recallRoles = Expr(
dialogRecallNS:ycolRecall = colListY << GetItems;
dialogRecallNS:orderRecall = colListX << GetItems;
);
/* Custom Launch Window */
customDlg = New Window( "Example of a Custom Dialog",
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Example dialog to demonstrate a Recall button" ),
H List Box(
V List Box(
Panel Box( "Select Columns",
colListData = Col List Box( All, width( lbWidth ), nLines( Min( nc, 10 ) ) )
)
),
Panel Box( "Cast Selected Columns into Roles",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Y", colListY << Append( colListData << GetSelected ) ),
colListY = Col List Box( width( lbWidth ), nmin( 1 ), nLines( 5 ), numeric ),
Button Box( "X", colListX << Append( colListData << GetSelected ) ),
colListX = Col List Box( width( lbWidth ), nLines( 1 ), numeric )
)
),
Panel Box( "Action",
Lineup Box( N Col( 1 ),
Button Box( "OK",
recallRoles;
exy = colListY << get items;
exx = colListX << get items;
pgm;
customDlg << CloseWindow;
),
Button Box( "Cancel", customDlg << CloseWindow ),
Button Box( "Reset", clearRoles ),
Text Box( " " ),
Button Box( "Remove",
colListY << RemoveSelected;
colListX << RemoveSelected;
),
Button Box( "Recall",
clearRoles;
/* Restore any previous settings from the namespace variables */
Try(
colListY << Append( dialogRecallNS:ycolRecall );
colListX << Append( dialogRecallNS:orderRecall );
);
)
)
)
)
)
)
);
colListx << set min items( 1 );
colListy << set min items( 1 );
請注意,我刪除了您提供的 JSL 中的幾行程式碼,這些程式碼似乎對範例沒有任何作用。
您可以從 Jim 提供的腳本中獲得靈感,然後將呼叫函數庫套用到其中。這很可能是學習 JSL 的許多不同知識的好方法(修改現有的工作解決方案以使用不同的套件)。我個人不喜歡回憶庫的工作方式,所以我沒有使用它(我正在製作自己的庫),但據我所知,它是目前實現回憶的最佳方法,而無需自己編寫所有內容。
這確實很接近,並且按照描述的那樣工作,但是,整個目的是有一種方法可以強制圖表根據註釋中的信息進行註釋,並以某種方式打破了本次修訂。
註釋遺失,註釋本身不包含任何內容。
Notes = Try(exy[i] << Get Property( "Notes" ));
Show(Notes);
知道為什麼會這樣嗎?
謝謝
再見
扳手頭
嘗試改變
Notes = Try(exy[i] << Get Property("Notes"));
到
Notes = Try(Column(dt, exy[i]) << Get Property("Notes"));
as << 取得列列錶框的項目回傳字串列表