cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
IMMunization
Level I

How do I export a chart WITHOUT the chart header?

Hello, I'm writing a script to generate several charts and export them to a specified folder, but I'm unable to save them in the format that I desire.

 

I have a control chart that I want to export to a directory specified by the user. Ideally, I would like the chart to save with no chart header, i.e., just the graphic with no text, like this:

IMMunization_0-1678895828390.png

 

I'm using the following line of code to save the chart to a directory:

 

(resultsChart << Child) << Save Picture ("C:\Folder\results.jpg", JPEG );

 

However, this code saves the chart with a header and footer, which I don't want:

IMMunization_1-1678896499955.jpeg

 

What else I've tried:

Adding another << Child argument to the script does not change the output.

((resultsChart << Child) << Child) << Save Picture ("C:\Folder\results.jpg", JPEG );

 

Saving the chart as HTML almost gives me the results I want, but not quite.

 

(resultsChart << Child) << Save HTML ("C:\Folder\results.html" );

This line of code will create a folder in the specified directory called gfx. This folder contains all the charts I need in the format I want, with no headers or footers, but I don't like this solution for several reasons:

 

  • The script saves a bunch of extra files that I don't need (i.e., the HTML files themselves)
  • I don't want to create a new subfolder in the directory I'm trying to save to. I'd rather be able to export my charts directly where I want them to go.
  • I want to be able to name my files when I export them, but the file names in gfx seem to be hard-coded.

 

Any guidance is appreciated. Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How do I export a chart WITHOUT the chart header?

I usually use Show Properties to find which object to target

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Shirts.jmp");
obj = dt << Control Chart(
	Sample Label(:Box),
	Sample Size(:Box Size),
	KSigma(3),
	Chart Col(:"# Defects"n),
	Chart Type(C)
);

Report(obj)["C of # Defects",BorderBox(1)] << Save Picture("C:\temp\testimg.png", png);
Open("C:\temp\testimg.png");

jthi_0-1678903264762.png

If you have JMP17 it is even easier as you get Box Path

jthi_1-1678903306943.png

 

-Jarmo

View solution in original post

3 REPLIES 3
Byron_JMP
Staff

Re: How do I export a chart WITHOUT the chart header?

Short Answer:

obj<<Dispatch( {}, "", GraphBuilderContainerBox, {save picture("test.png",png)} );

 

Long answer:

So, JMP does this super annoying thing where if you save the script for something, but part of the thing is selected, the saved script also catches that and you have to re-run the report script then select nothing and then save the script.

It's really annoying, except when I'm trying to find out how to reference some part of a report or graph.  In that case the script for the object includes a "Dispatch(some long string)",  and this is super useful!

 

I made a control chart, used the selection tool to select the part I wanted, then saved the script.

I edited the script like this:

obj=Control Chart Builder(...

That "obj" is just an arbitrary variable name, but it lets me send messages to "obj" which is the control chart object.

In the script one thing was selected:

	SendToReport(
		Dispatch( {}, "", GraphBuilderContainerBox, {select} ),

I tried swapping out things in the curly brackets and discovered that "save picture" worked. Then it was just a matter of formatting the argument correctly and there we go.

JMP Systems Engineer, Health and Life Sciences (Pharma)
jthi
Super User

Re: How do I export a chart WITHOUT the chart header?

I usually use Show Properties to find which object to target

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Quality Control/Shirts.jmp");
obj = dt << Control Chart(
	Sample Label(:Box),
	Sample Size(:Box Size),
	KSigma(3),
	Chart Col(:"# Defects"n),
	Chart Type(C)
);

Report(obj)["C of # Defects",BorderBox(1)] << Save Picture("C:\temp\testimg.png", png);
Open("C:\temp\testimg.png");

jthi_0-1678903264762.png

If you have JMP17 it is even easier as you get Box Path

jthi_1-1678903306943.png

 

-Jarmo
IMMunization
Level I

Re: How do I export a chart WITHOUT the chart header?

Perfect! This is my first time hearing about the Properties window and Box Paths, but it's exactly what I needed. Thank you much!