cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
srwhill
Level I

How to export JMP graph to PPT by JSL?

Hello, I am a new starter of JSL. I have managed to build box plots with local data filter (filted by dimension type) by JSL. And I want to export the box plots one dimension type by one dimension type (from the top of data filter to the bottom) to a powerpoint file. But I can not find the functions in JMP help file to make it happen. Appreciate if someone can grant help. I just want to know what functions are helpful on this, so I can look them up in JSL help file for the detail. Here is what I am trying to do... --> 1. Import excel data to JMP table.                     --> 2. Build box plots and local data filter(by dimension type, assuming I have 3 types A/B/C).     --> 3. Show box plot of dimension A, save it and export to first PPT slide.     --> 4. Automatically jump to dimension B, show box plot, save and export to second PPT slide.   --> 5. Same as last step to export box plot of dimension C to third PPT slide. Thanks for reading.
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to export JMP graph to PPT by JSL?

I fully understand what you are requesting.  However, sometimes features that are available in JMP that are targeted for interactive usage, do not translate very well to the scripting world.  The Local Data Filter is one of them.  It is really a fantastic interactive tool, but in the script below, you will see that it's usage in a script, just makes the script more complex.  And the interactive feature where the different values that are nicely displayed in the filter list, are not available from the filter when used in JSL.

Here is the script using a scripted local data filter

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is 
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
gb = Graph Builder(
	invisible,
	Size( 517, 437 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ) ),
	Elements( Box Plot( X, Y, Legend( 3 ) ) )
);

For( i = 1, i <= N Items( GroupBy ), i++,
	gb << Local Data Filter( Add Filter( columns( :Sex ), Where( :sex == GroupBy[i] ) ), Mode( Show( 1 ), Include( 1 ) ) );
	If( i == 1,
		gb << Save Presentation( "$TEMP/jmp_example2.pptx" ),
		gb << Save Presentation( "$TEMP/jmp_example2.pptx", Append )
	);
	gb << remove data filter;
);

Open( "$TEMP/jmp_example2.pptx" );

Here is the example that I have been using in answering your questions, that does not use the local data filter, and actually gets a better version of the output you want.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is 
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );

For( i = 1, i <= N Items( GroupBy ), i++,
	gb = dt << Graph Builder(
	// The invisible option helps to keep the desktop clean
		invisible,
		Size( 517, 437 ),
		Show Control Panel( 0 ),
		Variables( X( :age ), Y( :height ) ),
		Elements( Box Plot( X, Y, Legend( 3 ) ) ), 
	// Here is an easy way to subset the data used in the grap
		Where( :sex == GroupBy[i] )
	);
	If(i==1,
		gb << Save Presentation( "$TEMP/jmp_example.pptx"  ),
		gb << Save Presentation( "$TEMP/jmp_example.pptx", Append  );
	);
);

Open( "$TEMP/jmp_example.pptx" );

The second example is much simpler code

 

Jim

View solution in original post

7 REPLIES 7
txnelson
Super User

Re: How to export JMP graph to PPT by JSL?

Here is a sample script.

Names Default to Here( 1 );
// The open function below, just need to point to the .xls or .xlsx file you want to open
dt=open("$SAMPLE_DATA\Big Class.jmp");

// Run the Distribution Platform
dis=dt<<Distribution( stack(1),Continuous Distribution( Column( :height ) ),
	// By using the "By" clause you avoid having to play around with
	// the local data filter
	By( :sex ) );
// Write the desired output to the ppt
report(dis[1])["height"]<<save presentation("$TEMP/jmp_example.pptx" );
report(dis[2])["height"]<<save presentation("$TEMP/jmp_example.pptx",append );

// OPen the powerpoint presentation
Open( "$TEMP/jmp_example.pptx" );
Jim
srwhill
Level I

Re: How to export JMP graph to PPT by JSL?

Thanks for teaching me to use "save presentation()" to export charts to PPT. And this is real a good suggestion to use "By" instead of local data filter. However, in my case, I have to use graph builder to get box plots, which should not support "by" function. Moreover, actually I have dozens of dimensions, if I use "By" function, i may need to open dozens of charts at one time which looks not so good. Attached chart is basically what I want.  Looking forward to your response. Thanks.

Re: How to export JMP graph to PPT by JSL?

Graph Builder does support "by" but it is hidden from the drag and drop interface. If one opens an empty Graph Builder window, their is a button called dialog. This will open the dialog version of Graph Builder which contains a By element.
Chris Kirchberg, M.S.2
Data Scientist, Life Sciences - Global Technical Enablement
JMP Statistical Discovery, LLC. - Denver, CO
Tel: +1-919-531-9927 ▪ Mobile: +1-303-378-7419 ▪ E-mail: chris.kirchberg@jmp.com
www.jmp.com
txnelson
Super User

Re: How to export JMP graph to PPT by JSL?

To keep charts from displaying while the code is running, but not having been written to the ppt, the "Invisible" option can be specified within the Platform.  I have also added a way to handle your filtering so you can see an easy way to deal with that

I will also point out, that all of these options, etc. are documented and illustrated through examples @:

     Help==>Scripting Index

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
gb = dt << Graph Builder(
	// The invisible option helps to keep the desktop clean
	invisible,
	Size( 517, 437 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ) ),
	Elements( Box Plot( X, Y, Legend( 3 ) ) ), 
	// Here is an easy way to subset the data used in the grap
	Where( :sex == "F" )
);
New Window( "the graph", myvlb = V List Box() );
myvlb << append( Report( gb ) );
Jim
srwhill
Level I

Re: How to export JMP graph to PPT by JSL?

Hi Jim, Thanks for your continuos coaching.  Understand we can subset data by "Where". But the data(dimension) i am trying to filtrate has 26 values (from A to Z), so i want to find a easier way instead of repeatedly using 26 times "Where".  What i can think of is local data filter.....I attached my filter fyr. All i want is to get a way to automatically scroll down the filter from A to Z, and output the corresponding 26x graphs to PPT.  Till now, i still did not find in scripting index. 
txnelson
Super User

Re: How to export JMP graph to PPT by JSL?

I fully understand what you are requesting.  However, sometimes features that are available in JMP that are targeted for interactive usage, do not translate very well to the scripting world.  The Local Data Filter is one of them.  It is really a fantastic interactive tool, but in the script below, you will see that it's usage in a script, just makes the script more complex.  And the interactive feature where the different values that are nicely displayed in the filter list, are not available from the filter when used in JSL.

Here is the script using a scripted local data filter

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is 
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );
gb = Graph Builder(
	invisible,
	Size( 517, 437 ),
	Show Control Panel( 0 ),
	Variables( X( :age ), Y( :height ) ),
	Elements( Box Plot( X, Y, Legend( 3 ) ) )
);

For( i = 1, i <= N Items( GroupBy ), i++,
	gb << Local Data Filter( Add Filter( columns( :Sex ), Where( :sex == GroupBy[i] ) ), Mode( Show( 1 ), Include( 1 ) ) );
	If( i == 1,
		gb << Save Presentation( "$TEMP/jmp_example2.pptx" ),
		gb << Save Presentation( "$TEMP/jmp_example2.pptx", Append )
	);
	gb << remove data filter;
);

Open( "$TEMP/jmp_example2.pptx" );

Here is the example that I have been using in answering your questions, that does not use the local data filter, and actually gets a better version of the output you want.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
// Get the levels of the Sex column. The Summarize function will
// create a list of the different levels of whatever column is 
// specified in the "By" claue
Summarize( dt, GroupBy = By( :Sex ) );

For( i = 1, i <= N Items( GroupBy ), i++,
	gb = dt << Graph Builder(
	// The invisible option helps to keep the desktop clean
		invisible,
		Size( 517, 437 ),
		Show Control Panel( 0 ),
		Variables( X( :age ), Y( :height ) ),
		Elements( Box Plot( X, Y, Legend( 3 ) ) ), 
	// Here is an easy way to subset the data used in the grap
		Where( :sex == GroupBy[i] )
	);
	If(i==1,
		gb << Save Presentation( "$TEMP/jmp_example.pptx"  ),
		gb << Save Presentation( "$TEMP/jmp_example.pptx", Append  );
	);
);

Open( "$TEMP/jmp_example.pptx" );

The second example is much simpler code

 

Jim
ram
ram
Level IV

Re: How to export JMP graph to PPT by JSL?

May i ask, if there is option to use custome ppt template. where we can add multiple graphs in one slide  if we have a template?