获取当前显示在树状图上的行你好,
我想知道在缩放操作后是否有办法知道哪些人当前显示在树状图上。
这是一个例子:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch(
{"Dendrogram"},
"2",
ScaleBox,
{Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )}
)
)
);我想获得选定的 13 个国家/地区的列表。
我认为,一个好的解决方案是获取最小值和最大值(18 和 31),但到目前为止我找不到如何提取它们......
在此先感谢您的帮助!
回复:获取当前显示在树状图上的行你好@txnelson ,
我从未使用过此功能,但它确实扩大了 JMP 的可能性,太好了!
在我的情况下,我并不真的需要选择行,而只是为了获取 minOrder 和 maxOrder 值。 这就是为什么我认为不会有提到的干扰问题@朱利安. 我需要测试一下:)
再次感谢你们两位的帮助!
回复:获取当前显示在树状图上的行啊,我们走了。 早该想到那个!
//编辑:添加该图形脚本似乎会干扰双击以放大所选集群。 当然有一些方法可以让它工作,但目前该按钮似乎相当万无一失,特别是如果您希望能够在树状图中选择个人,然后将选择重新建立到当前缩放。
回复:获取当前显示在树状图上的行您可以附加图形脚本
obj << 添加图形脚本()
到树状图框架框。每当对图表执行某些操作时,它都会触发。在添加的脚本中,您可以检查 minOrder 或 MaxOrder 是否已更改。
回复:获取当前显示在树状图上的行你好@anne_sa ,
这是个好主意,但我还没有找到一个简单的方法来实现它。 窗口底部的按钮调用选择怎么样?
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
hcPlatform = Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch( {"Dendrogram"}, "2", ScaleBox, {Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )} )
)
);
//save the order displayed in the platform
displayOrd = hcPlatform << Save Display Order;
selectZoom = expr(
//get the script, which contains the Min() and Max() information
exprPlat = hcPlatform << Get Script;
//Extract the Min and Max. This is indexed in the reverse of the Display Order
//that is, the max value is the first in the order (as if it is an axis), so subtracting
//this value from the number of rows in the table brings things into alignment
minOrder = 1 + N Rows( dt ) - Arg( Extract Expr( exprPlat, Max( Wild() ) ) );
maxOrder = N Rows( dt ) - Arg( Extract Expr( exprPlat, Min( Wild() ) ) );
//select the rows in the table that meet the condition of being in the randge displayed
dt << Select Where( And( As Column( displayOrd ) >= minOrder, As Column( displayOrd ) <= maxOrder ) );
//get the matrix of row numbers for the selected rows, i.e., rows displayed in zoom
matchingRows = dt << get selected rows;
);
//add the button to the report
report(hcPlatform)<<APPEND></APPEND>
@朱利安
回复:获取当前显示在树状图上的行你好@朱利安,
非常感谢您的快速回答,这正是我想要的!!!
我还有一个额外的小问题:有没有一种方法可以检测树状图上是否进行了缩放操作? 也许是基于 <回复:获取当前显示在树状图上的行做得很好。
回复:获取当前显示在树状图上的行
你好@anne_sa ,
我不知道获取这些行的直接方法,但由于 Min 和 Max 信息是平台脚本的一部分,并且因为我们可以保存树状图中行的显示顺序,所以我们可以编写自己的方式只需一点工作即可获得结果。 它并不完全优雅,但这是我想出的一种方法:
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Birth Death Subset.jmp" );
hcPlatform = Hierarchical Cluster(
Y( :birth, :death ),
Label( :country ),
Method( "Ward" ),
Standardize Data( 1 ),
Dendrogram Scale( "Distance Scale" ),
Number of Clusters( 4 ),
SendToReport(
Dispatch( {}, "Dendrogram", OutlineBox, {SetHorizontal( 1 )} ),
Dispatch( {"Dendrogram"}, "2", ScaleBox, {Min( 18 ), Max( 31 ), Inc( 5 ), Minor Ticks( 0 )} )
)
);
//save the order displayed in the platform
displayOrd = hcPlatform << Save Display Order;
//get the script, which contains the Min() and Max() information
exprPlat = hcPlatform << Get Script;
//Extract the Min and Max. This is indexed in the reverse of the Display Order
//that is, the max value is the first in the order (as if it is an axis), so subtracting
//this value from the number of rows in the table brings things into alignment
minOrder = 1 + N Rows( dt ) - Arg( Extract Expr( exprPlat, Max( Wild() ) ) );
maxOrder = N Rows( dt ) - Arg( Extract Expr( exprPlat, Min( Wild() ) ) );
//select the rows in the table that meet the condition of being in the randge displayed
dt << Select Where( And( As Column( displayOrd ) >= minOrder, As Column( displayOrd ) <= maxOrder ) );
//get the matrix of row numbers for the selected rows, i.e., rows displayed in zoom
matchingRows = dt << get selected rows;
我希望这有帮助!
@朱利安