@Craige_Hales , nice, very smooth! : )
Almost too smooth: I hope this example will not stop the developers from implementing a non-JSL approach.
some arguments for a native support via Graph Builder:
- make native Graph Builder more powerful
- make the non-JSL users happy as well
- show the automatic fancy annotations even without mouse clicks
-> allow the users to use the mouse as usual to select data points
(with the current "JSL" approach, one might add some toggle buttons to choose the correct mode - like it's implemented for Venn Diagram )
It took me a while to understand the error message!
Names default to here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = dt << Graph Builder(
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
// x=y=60;
fb = Report( gb )[FrameBox( 1 )];
fb << addgraphicsscript(//
If(Not( Is Empty( x ) ), // if the mouse did not yet enter the graph -> do nothing.
Mousetrap("nothing to do");
V Line(x);
// at this point you can highlight all the values near xx
For( irow = 1, irow <= N Rows( dt ), irow += 1,
If( Abs( dt:height[irow] - x ) < 0.5, // big class height step is 1, <.5 selects a single column of weights
Marker( Marker State( 4 ), {dt:height[irow], dt:weight[irow]} )
)
);
xwidth = X Range();
xmidpoint = X Origin() + xwidth / 2;
If( x < xmidpoint,
Text( {x + xwidth / 100, y}, "height " || Char( Round( x ) ) || "\!nmore" )//
,
Text(
right justified,
{x - xwidth / 100, y},
"height " || Char( Round( x ) ) || "\!nmore"
)
);
)
//
);