Embed a picture of a data table in a chart.
@Neo asked Is it possible to get a row & columns from an open table as inset in to a chart?
fontscale = 2;
picScale = .42;
topFraction = 0.95;
bottomFraction = 0.05;
dt = Open( "$sample_data/big class.jmp" );
box = dt << journal;
oldFont = Get Preferences( fonts );
Preferences( Fonts( English( Text Font( "Segoe UI", 9 * fontscale ), Heading Font( "Segoe UI", 12 * fontscale, "Bold" ), ) ) );
pic = box << getpicture;
{xPixPixels, yPicPixels} = pic << size;
box << closewindow;
Eval( oldFont );
gb = Graph Builder(
Show Control Panel( 0 ),
Size( 1158, 894 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) )
);
{xFramePixels, yFramePixels} = (Report( gb )[FrameBox( 1 )]) << getsize;
xmin = (Report( gb )[axisBox( 1 )]) << getmin;
xmax = (Report( gb )[axisBox( 1 )]) << getmax;
xUnitsPerPixel = (xmax - xmin) / xFramePixels;
ymin = (Report( gb )[axisBox( 2 )]) << getmin;
ymax = (Report( gb )[axisBox( 2 )]) << getmax;
yUnitsPerPixel = (ymax - ymin) / yFramePixels;
topPos = ymin + (ymax - ymin) * topFraction;
leftPos = xmin + (xmax - xmin) * bottomFraction;
bottomPos = topPos - picScale * yPicPixels * yUnitsPerPixel;
rightPos = leftPos + picScale * xPixPixels * xUnitsPerPixel;
(Report( gb )[FrameBox( 1 )]) << Add Image( image( pic ), bounds( top( topPos ), Left( leftPos ), bottom( bottomPos ), Right( rightPos ) ) );
gb << savepicture( "$temp/example.png" );
gb << closewindow;
Close( dt, nosave );
Open( "$temp/example.png" );
A picture of a journaled data table embedded in a graph.
If you right-click->Customize the graph, you can see the default behavior for images puts them behind the graph.
The list items are drawn in order from top to bottom (painter's algorithm.) The picture is below the graph.
You can move the picture to be drawn after the graph, but that usually won't be desirable.
The picture has a solid white background that blocks the graph.