JSL 如何在这样的图中实现点击获取变量值?请按照下面的脚本进行操作。
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p1 = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
);
JSL怎么写 如何实现在图中通过点击某个年龄条,得到这个年龄值?并利用这个值来执行后续操作。
谢谢!

基础数据分析和建模分享和交流结果回复: JSL是如何实现这样一个图中的点击获取变量值的呢?如果点击这个箭头所指的空格,可以得到年龄值=14吗?
这是鼠标左键单击,而不是悬停标签。
回复: JSL是如何实现这样一个图中的点击获取变量值的呢???
frame = (p1 << report)[FrameBox( 1 )];
frame << Set Graphlet(
Picture(
dataage = Parse( age:_where );//??
d2 = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
d2 << Select Where( age == dataage );
d3 = d2 << Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );
Try( d3 << Delete Table Property( "Source" ) );
),
Reapply( 1 )
);
回复: 在这样的图中JSL是如何实现点击获取变量值的?
回复: 在这样的图中JSL是如何实现点击获取变量值的?如果用Hover Labels触发,为什么只能在年龄==12时触发打开Big Class Families.jmp?
谢谢!
txt = "a";
Set Clipboard( txt );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p1 = dt << Graph Builder(
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
,
SendToReport(
Dispatch(
{},
"Graph Builder",
FrameBox,
Set Textlet(
Setup(
expr = Parse( local:_where );
a = local:_dataTable << Get Rows Where( expr );
Set Clipboard( a[1] );
local:r = local:_dataTable << Get Rows Where( expr );
),
Markup( "{local:r}rows" )
)
)
)
);
txt = Get Clipboard();
frame = (p1 << report)[FrameBox( 1 )];
frame << Set Graphlet(
Picture(
dataage = txt; //Parse( age:_where );//??
d2 = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
d2 << Select Where( age == dataage );
d3 = d2 << Subset( Output Table( "test" ), Selected Rows( 1 ), selected columns( 0 ) );
Try( d3 << Delete Table Property( "Source" ) );
),
Reapply( 1 )
);
回复: JSL是如何实现这样一个图中的点击获取变量值的呢?dt = Open( "$SAMPLE_DATA/Big Class.jmp", invisible );
p1 = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
);
// this graphbuilder chart has multiple FrameBoxes. Get a list of them.
framelist = Report( p1 ) << XPath( "(//OutlineBox[text()='Graph Builder']//FrameBox)" );
// each framebox needs a graphis script with a Mousetrap to detect clicks.
For( iFrame = 1, iFrame <= N Items( framelist ), iFrame += 1,
frame = framelist[iFrame];
// the mousetrap needs to capture the iFrame value when it is
// built so it can report it later; use eval(evalexpr(...expr()...))
Eval(
Eval Expr(
frame << Addgraphicsscript(
Mousetrap(
{/*nothing on mouse drag, it happens a lot*/}//
, // but on mouse up, do something. MouseUp only happens once per click.
xx = x;
yy = y;
Show( xx, yy, Expr( iFrame ) );
// run your script here
)
)
)
);
);回复: JSL是如何实现这样一个图中的点击获取变量值的呢?感谢专家!
非常神奇,看到了xx、yy 和 Expr(iFrame) 的变化。

回复: JSL是如何实现这样一个图中的点击获取变量值的呢?但为什么这个脚本在JMP Pro 17.0中文版中不起作用呢?
赢10
谢谢!

回复: JSL是如何实现这样一个图中的点击获取变量值的呢?将我的 JMP 17 版本设置为英文。
可以,但是日志里会有中文?
谢谢!

回复: JSL是如何实现这样一个图中的点击获取变量值的呢?好的
谢谢克雷格!
您教会了我如何解决问题,使我不再只是复制代码。
感谢专家!

回复: 在这样的图中JSL是如何实现点击获取变量值的?我抓住了这个
"(//OutlineBox[text()='Graph Builder']//FrameBox)"
从这里
right-click the outline triangle, choose Show Properties. Click one of the graphs.right-click the outline triangle, choose Show Properties. Click one of the graphs.right-click the outline triangle, choose Show Properties. Click one of the graphs.right-click the outline triangle, choose Show Properties. Click one of the graphs.right-click the outline triangle, choose Show Properties. Click one of the graphs.右键单击轮廓三角形,选择“显示属性”。单击其中一个图形。
你可以将其简化为
framelist = Report( p1 ) << XPath( "(//FrameBox)" );
回复: 在这样的图中JSL是如何实现点击获取变量值的?仍然希望通过单击图形来触发脚本,而不是通过悬停标签
但是这个图形改变了形式,我不知道如何改写JSL。
我不得不回去找专家。
谢谢!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
p1 = dt << Graph Builder(
Size( 632, 1152 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :weight ), Y( :height ) ),
Elements(
Bar( X, Y, Legend( 5 ), Bar Style( "Stacked" ), Response Axis( "X" ), Summary Statistic( "Sum" ) )
)
);
gp = Report(p1)["Graph Builder",FrameBox(1)]
Eval(
Eval Expr(
gp << Addgraphicsscript(
Mousetrap(
{},
a0 = Expr( iFrame );
dt << Select Where( :height == a0 );
dt << Select Columns( "height" );
d3 = dt << Subset( Output Table( "test" ), Selected Rows( 1 ), columns( height ) );
)
)
)
);回复: 在这样的图中JSL是如何实现点击获取变量值的?如果你懒得去酒吧——
- 添加 HeatMap 图
- 禁用 x 和 y 变量
- 并将透明度设置为 0:
回复: 在这样的图中JSL是如何实现点击获取变量值的?对于那些懒得点击或懒得使用表达式处理的人:请使用悬停标签的图片部分。
反应是立即的(比悬停标签出现所需的时间快得多)。
dt = Open( "$SAMPLE_DATA/Big Class.jmp", invisible );
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :weight ), Y( :height ), Group X( :age ), Color( :sex ) ),
Elements( Bar( X, Y, Legend( 5 ), Response Axis( "X" ), Summary Statistic( "Sum" ) ) )
);
fbs = Report( gb ) << XPath( "//FrameBox" );
For Each( {fb}, fbs,
fb << Set Graphlet( Picture( Caption( Char( myAge = :age[local:_firstRow] ) ) ) )
);回复: How does JSL implement a click-to-get variable value in such a graph?