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
SpannerHead
Level VI

Export or Save a Data Table as an Image File

I can see how to readily create an image file from a graph.  Is it possible to do the same with a data table?


Slán



SpannerHead
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Export or Save a Data Table as an Image File

Hi @SpannerHead,

 

Gotcha, let's try it a different way:

pickdir=pick directory();//pick where you want your file to go
dt=current data table();
//clear selections - if the selected column is left it will only bring that column into the journal
dt<<clear select();
dt << Clear Column Selection();

journaltext = (Window( dt )) << getjournal;
journalbox = Journal Box( journaltext );
image = journalbox << getpicture;
//nw=New Window( "image", image );//opening the journal so you can see the appearance-this line isnt needed

image<< Save Image( saveloc=pickdir||"Journalgraph.png", "png" );
open(saveloc);

Thanks,

Ben

“All models are wrong, but some are useful”

View solution in original post

6 REPLIES 6
SpannerHead
Level VI

Re: Export or Save a Data Table as an Image File

Looks like I can do this from Journal.  Just need a means to make the code generic to any table?


Slán



SpannerHead

Re: Export or Save a Data Table as an Image File

Hi @SpannerHead ,

 

Here's a generic JSL that will work with any table by sending it over to a journal and saving as you've requested. I've added a prompt at the start so you can pick where you want the file to save.

 

pickdir=pick directory();//pick where you want your file to go
dt=current data table();
nw = New Window( "data table journal",<<journal, 
placeholder_VLB=v list box());

placeholder_VLB<<append(data table box(dt));

image=nw<<get picture;
image<< Save Image( saveloc=pickdir||"Journalgraph.png", "png" );
open(saveloc);

Thanks,

Ben

“All models are wrong, but some are useful”
SpannerHead
Level VI

Re: Export or Save a Data Table as an Image File

Ben

 

Clever script!  Only remaining issue is that the resulting Journal loses all it's formatting from the original table.  The original had a lot of colouration indicating pass or fail.


Slán



SpannerHead

Re: Export or Save a Data Table as an Image File

Hi @SpannerHead,

 

Gotcha, let's try it a different way:

pickdir=pick directory();//pick where you want your file to go
dt=current data table();
//clear selections - if the selected column is left it will only bring that column into the journal
dt<<clear select();
dt << Clear Column Selection();

journaltext = (Window( dt )) << getjournal;
journalbox = Journal Box( journaltext );
image = journalbox << getpicture;
//nw=New Window( "image", image );//opening the journal so you can see the appearance-this line isnt needed

image<< Save Image( saveloc=pickdir||"Journalgraph.png", "png" );
open(saveloc);

Thanks,

Ben

“All models are wrong, but some are useful”
SpannerHead
Level VI

Re: Export or Save a Data Table as an Image File

Ben

 

That works!  Mighty!

 

 

 


Slán



SpannerHead
jthi
Super User

Re: Export or Save a Data Table as an Image File

You can also << get as report + << get picture (<< Get As Report can be helpful in many other places also not just here)

 

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

r = dt << Get As Report;
img = r << Get Picture;

img << Save Image("$TEMP/pic.png", "png");

Open("$TEMP/pic.png");

 

If you wish to access the table box which << get as report does create, you can use << Child on the created display box (it is a border box on highest level)

 

View more...
Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

r = dt << Get As Report);
tb = r << child;
tb << Set Title Font Style("Bold");

img = tb << Get Picture;
img << Save Image("$TEMP/pic.png", "png");

Open("$TEMP/pic.png");

Write();

or data table box (this won't support coloring)

 

 

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

r = Data Table Box(dt);
img = r << Get Picture;

img << Save Image("$TEMP/pic.png", "png");

Open("$TEMP/pic.png");

 

-Jarmo

Recommended Articles