cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Learn how to build custom Python data connectors and further customize JMP’s Data Connector Framework with the Python Data Connector Demo, available now in the JMP Marketplace!
  • See how to create experiments to support product design and ID useful product features. Register for June 12 webinar, 2pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
thickey
Level III

Adding FrameBox Content to a Datatable as an image.

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

Recommended Articles