Saving Journal as PNG (or PDF)I am trying to save a very basic table as a PNG (or PDF). I am able to create a journal with my table but haven't been able to get it to save properly. From reading on this message board and consulting the scripting guide the below should work but it doesn't actually save anything.
Any help would be appreciated.
Names default to here(1);
dt = current data table();
path_to_results=Pick Directory("Results folder");
r = Column Dialog(
cats = Col List("Categories", Max Col( 10 ), MinCol( 0 )),
);
cat = r["cats"];
st = Data Table( Eval(TableName) ) <<
Summary(
Group(
:Label1,
Eval(cat)
)
);
jrn = st << Journal;
jrn << SavePDF( path_to_results||"categorychart.pdf");Re: Saving Journal as PNG (or PDF)and @SDF1 has a great solution using a dashboard.
https://community.jmp.com/t5/Discussions/Save-Graph-amp-Datatable-and-output-as-png-file/m-p/221844#M44269
Re: Saving Journal as PNG (or PDF)Sorry, I missed the data table bit. Data tables don't act like analysis platforms when trying to take pictures of their display boxes. Here's another approach, using a journal box.
dt = Open( "$sample_data/Cereal.jmp" );
journaltext = (Window( dt )) << getjournal;
journalbox = Journal Box( journaltext );
image = journalbox << getpicture;
New Window( "image", image );
pdf = journalbox << savepdf( "$temp/cereal.pdf" );
Open( "$temp/cereal.pdf" );
image capture of tableimage capture of tableimage capture of table
You can save an image with
journalbox << savepicture( "$temp/cereal.png", "png" );
Re: Saving Journal as PNG (or PDF)To close this. I was able to find a solution to do what I wanted.
I wrote a function to display my table in a new window and then saved that new window as a png file.
SplitChartCreator = Function({dt,path_to_results},{Default Local},
r = Column Dialog(
split = Col List("Split Columns", Max Col( 10 ), MinCol( 0 )),
);
splits = r["split"];
st = dt <<
Summary(
Group(
:Lot,
:Wafer,
Eval(splits)
)
);
st << Delete Columns ( "N Rows" );
tb = Table Box();
For (i=1,i<=NCols(st),i++,
col = Column(st,i);
colName = col << Get Name;
lstValues = col << Get Values;
type = col << Get Data Type;
If (type=="Character",
tb << Append(
String Col Box(colName,lstValues)
)
,
tb << Append(
Number Col Box(colName,lstValues)
)
);
);
content = H List Box(
Outline Box("splitchart", << Outline Close Orientation("Vertical"),
tb
)
);
pw = New Window("splitchart", content);
img = pw << getpicture();
img << saveImage(path_to_results||"splitchart.png", "png");
Close(st, NoSave);
pw << Close Window();
);Re: Saving Journal as PNG (or PDF)Yes. @Wendy_Murphrey just posted an xpath way to navigate to a node in the display box tree, or you can use the display box subscripting. When you get to the right node, save it as a PNG. Something like this using display box subscripts.
from the top left red triangle in the report, Edit->Show Tree Structurefrom the top left red triangle in the report, Edit->Show Tree Structurefrom the top left red triangle in the report, Edit->Show Tree Structure
Use the show tree structure command to identify the part of the report you need. Here, picture box(1) captures the graph without the title for the entire section. Then, use JSL like this:
dt = Open( "$sample_data/big class.jmp" );
dist = dt << Distribution(
Continuous Distribution( Column( :weight ) ),
Nominal Distribution( Column( :age ) )
);
boxtree = Report( dist );
picbox = boxtree[Picture Box( 1 )];
picbox << savepicture( "$desktop/distrib.png", "png" );
The captured PNG fileThe captured PNG fileThe captured PNG file
At the point when I had the picbox variable set, I was not sure what the command was to take a picture. I used this to find out what commands were available for that box:
showproperties(picbox)
and found this in the list:
save picture commandsave picture commandsave picture command
which you can then look up in the scripting index:
Help->Scripting IndexHelp->Scripting IndexHelp->Scripting Index
Re: Saving Journal as PNG (or PDF)Thanks. That does fix the problem with the SavePDF feature but alas this isn't doing what I want. Really what I need to do is save the small table as an image rather than all the extra. Any suggestions on how to just save a PNG with the table only? Possibly something along the lines of creating a table in a new window and then saving an image of the new window as a PNG.
Re: Saving Journal as PNG (or PDF)In JMP 14, <
jrn=currentjournal();
and then save the pdf.