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!
I grabbed this
"(//OutlineBox[text()='Graph Builder']//FrameBox)"
from here
right-click the outline triangle, choose Show Properties. Click one of the graphs.
you might simplify it to
framelist = Report( p1 ) << XPath( "(//FrameBox)" );
If click on the space indicated by this arrow, can get the age value =14?
It's a left mouse click, not Hover Labels.
??
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 to execute this JSL with a mouse click?
If it is triggered with Hover Labels, why can it only be triggered to open Big Class Families.jmp at age ==12?
How can I make other age columns trigger as well?
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 )
);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
)
)
)
);
);
Thanks Experts!
Very amazing, have seen xx, yy and Expr(iFrame) changes.
But why doesn't this script work in the Chinese version of JMP Pro 17.0?
win10
Thanks!
Set my version 17 of JMP to English.
It works, but there will be Chinese in the log?
Thanks!
I grabbed this
"(//OutlineBox[text()='Graph Builder']//FrameBox)"
from here
right-click the outline triangle, choose Show Properties. Click one of the graphs.
you might simplify it to
framelist = Report( p1 ) << XPath( "(//FrameBox)" );