我在原始帖子中发布了这个问题,但可能没有得到正确的突出显示,因此尝试以新帖子的形式发布。
此链接处的代码看起来非常有用
如何在自定义窗口上创建调用按钮 - 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 )
)
)
)
)
);
)
);
谢谢
再见
扳手头
再见,
以下是您的脚本与如何在自定义窗口上创建调用按钮中引用的脚本的简单组合。首先,您提供的示例使用列对话框(),而调用示例使用新窗口作为用户对话框。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"));
作为<<获取 Col 列表框的项目返回字符串列表