cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.

Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.

Choose Language Hide Translation Bar
View Original Published Thread

Adding FrameBox Content to a Datatable as an image.

thickey
Level III

How do I take the output from Graphbuilder,  grab the main FRAMEBOX as an image, resize it and add it to a datatable?

 

I make my output using Graph builder and then run the following.

obj = GB << Get Scriptable Object;
r= obj << Report;
myImage = r[FrameBox(1)];
myImage << setSize(100, 100);
DT:GFA[1] = myImage;  //Row 1 of column 'GFA' (Expression Column) in a Table called 'DT'

I think my issues is the 'image' returned is not an actual image but rather a display box.

 

Cheers, Troy

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Craige_Hales
Super User


Re: Adding FrameBox Content to a Datatable as an image.

You might, or might not, want to resize it (<<scale below) because it will be scaled to fit later. If you don't resize, the original resolution is available if you want it.

dt=open("$sample_data/big class.jmp");
r = dt<<Graph Builder(
    Size( 518, 448 ),
    Show Control Panel( 0 ),
    Variables( X( :weight ), Y( :height ) ),
    Elements( Points( X, Y, Legend( 12 ) ), Smoother( X, Y, Legend( 13 ) ) )
);
myImage = ((r<<report)[FrameBox(1)])<<getpicture;
myImage<<scale(.25);

dtPics = New Table( "pics",
    Add Rows( 1 ),
    Set Cell Height( 100 ),
    New Column( "graphs", Expression, "None", Set Display Width( 150 ) )
);

dtPics:graphs[1] = myImage;

In the example, 'r' is the scriptable report object, not the displaybox tree, You can ask the object for the tree with either r<<report or report(r). Navigating down the tree to Framebox(1) using subscripting finds the first framebox; there are no axes. If you want axes, pick a box higher in the tree that includes them. ShowTreeStructure can be really helpful.

The captured picture is just the framebox.The captured picture is just the framebox.

Edit: still asleep. You had the variable names correct; I should have used 'obj' rather than 'r' because 'r' should be for the report surface which is the display box tree.

 

Craige

View solution in original post

2 REPLIES 2
Craige_Hales
Super User


Re: Adding FrameBox Content to a Datatable as an image.

You might, or might not, want to resize it (<<scale below) because it will be scaled to fit later. If you don't resize, the original resolution is available if you want it.

dt=open("$sample_data/big class.jmp");
r = dt<<Graph Builder(
    Size( 518, 448 ),
    Show Control Panel( 0 ),
    Variables( X( :weight ), Y( :height ) ),
    Elements( Points( X, Y, Legend( 12 ) ), Smoother( X, Y, Legend( 13 ) ) )
);
myImage = ((r<<report)[FrameBox(1)])<<getpicture;
myImage<<scale(.25);

dtPics = New Table( "pics",
    Add Rows( 1 ),
    Set Cell Height( 100 ),
    New Column( "graphs", Expression, "None", Set Display Width( 150 ) )
);

dtPics:graphs[1] = myImage;

In the example, 'r' is the scriptable report object, not the displaybox tree, You can ask the object for the tree with either r<<report or report(r). Navigating down the tree to Framebox(1) using subscripting finds the first framebox; there are no axes. If you want axes, pick a box higher in the tree that includes them. ShowTreeStructure can be really helpful.

The captured picture is just the framebox.The captured picture is just the framebox.

Edit: still asleep. You had the variable names correct; I should have used 'obj' rather than 'r' because 'r' should be for the report surface which is the display box tree.

 

Craige
thickey
Level III


Re: Adding FrameBox Content to a Datatable as an image.

Thanks Craig. I've recently started to pull all my images into tables rather than working with external images from a directory. Makes for much easier application development.

 

Thanks for putting together a full working solution.

 

Troy