How does JSL implement a click-to-get variable value in such a graph?Follow the script below.
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" ) ) )
);
How to write JSL How to achieve in the graph by clicking on a certain age bar, get this age value?And use this value to perform subsequent operations.
Thanks!

Basic Data Analysis and ModelingSharing and Communicating Results回复: How does JSL implement a click-to-get variable value in such a graph?If click on the space indicated by this arrow, can get the age value =14?
It's a left mouse click, not Hover Labels.
回复: How does JSL implement a click-to-get variable value in such a graph???
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 )
);
回复: How does JSL implement a click-to-get variable value in such a graph?
回复: How does JSL implement a click-to-get variable value in such a graph?If it is triggered with Hover Labels, why can it only be triggered to open Big Class Families.jmp at age ==12?
Thanks!
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 )
);
回复: How does JSL implement a click-to-get variable value in such a graph?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
)
)
)
);
);回复: How does JSL implement a click-to-get variable value in such a graph?Thanks Experts!
Very amazing, have seen xx, yy and Expr(iFrame) changes.

回复: How does JSL implement a click-to-get variable value in such a graph?But why doesn't this script work in the Chinese version of JMP Pro 17.0?
win10
Thanks!

回复: How does JSL implement a click-to-get variable value in such a graph?Set my version 17 of JMP to English.
It works, but there will be Chinese in the log?
Thanks!

回复: How does JSL implement a click-to-get variable value in such a graph?I grabbed this
"(//OutlineBox[text()='Graph Builder']//FrameBox)"
from here
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.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.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.
you might simplify it to
framelist = Report( p1 ) << XPath( "(//FrameBox)" );
回复: How does JSL implement a click-to-get variable value in such a graph?OK
Thank Craige!
You taught me how to solve problems so that I didn't just copy code.
Thanks Experts!

回复: How does JSL implement a click-to-get variable value in such a graph?Still want to trigger scripts by clicking on graphics, not by Hover Labels
But this graphic changes form, and I don't know how to change to write JSL.
I had to go back to the experts.
Thanks!

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 ) );
)
)
)
);回复: How does JSL implement a click-to-get variable value in such a graph?and if you are too lazy to hit the bars - just
- add a HeatMap plot
- with disabled x and y variables
- and transparency set to 0:
回复: How does JSL implement a click-to-get variable value in such a graph?For those who are too lazy to click - or too lazy to use Expression Handling: use the Picture part of the Hover label.
The reaction is immediate (much faster than the time it takes till the hover label appears).
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?