Another approach, requiring more JSL for custom Markers.
Using an image for the marker. Use As Marker will show up in other graphs.
There are two Roberts in Big Class; the Needle is the average. The points are shown for both.
dt = Open( "$sample_data/big class.jmp" );
dt << New Column( "height-mean", formula( height - Col Mean( height ) ) );
dt << Color by Column( :Age );
// build the floating round marker...
dt << New Column( "marker",
expression,
formula(
box = (Graph Box(
// make a small drawing space 100x100 pixels, scaled from -1 to 1. Black background becomes transparent below
framesize( 100, 100 ), X Scale( -1, 1 ), Y Scale( -1, 1 ), <<backgroundcolor( RGB Color( 0, 0, 0 ) ),
// use the row's color. it is pretty dark when filled
Fill Color( Color Of( Row State() ) );
Circle( {0, 0}, .75, "FILL" );
Text Color( RGB Color( 1, 1, 1 ) );//white
Text Size( 40 );// adjust as needed
Text( CenterJustified, {0, -.35/*adjust as needed for v-center*/}, Char( height ) );
));
// trim the frame edges and make a transparent background
{r, g, b} = ((box[FrameBox( 1 )]) << getimage) << getpixels( "rgb" );
r = r[4 :: (N Rows( r ) - 5), 4 :: (N Cols( r ) - 5)];//trim
g = g[4 :: (N Rows( g ) - 5), 4 :: (N Cols( g ) - 5)];//trim
b = b[4 :: (N Rows( b ) - 5), 4 :: (N Cols( b ) - 5)];//trim
a = r + g + b != 0;
Show( r, g, b, a );
New Image( "rgba", {r, g, b, a} );
),
<<useformarker // use this column for markers
);
dt << Graph Builder(
Size( 1200, 500 ),
Show Control Panel( 0 ),
Show Legend( 0 ),
Variables( X( :name ), Y( :Name( "height-mean" ) ) ),
Elements( Bar( X, Y, Legend( 5 ), Bar Style( "Needle" ) ), Points( X, Y, Legend( 7 ) ) ),
SendToReport(
Dispatch(
{},
"height-mean",
ScaleBox,
{Min( -15 ), Max( 11 ), Inc( 5 ), Minor Ticks( 1 ), Add Ref Line( 0, "Solid", "Gray", "", 1 )}
),
Dispatch( {}, "400", ScaleBox, {Legend Model( 5, Properties( 0, {Line Color( 82 )}, Item ID( "Mean", 1 ) ) )} ),
Dispatch( {}, "graph title", TextEditBox, {Set Text( "difference from mean" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "" )} )
)
);
Craige