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
Saravana
Level II

How to use Graph boxes in the JMP Application builder

Hi all,

 

I am new to JMP. I am building a JMP application to read data from a JMP table and plot the data (Column 1 vs Column 2) in the graph box available in the JMP application. I was able to read the data from the table but not able to plot the graph in th graph box. I think I am not using proper script for graph box.

 

Can any one explain how to display graph in graph box for my use case?

2 ACCEPTED SOLUTIONS

Accepted Solutions
txnelson
Super User

Re: How to use Graph boxes in the JMP Application builder

The typical method used for adding a graph into a JMP Application, is to first interactively create the required graph or plot using one of the JMP Platforms(i.e. Fit Y by X, Distributions, etc.) and then open the Application Builder, where you then will see the graph or plot, and you then can drag it into your application.  JMP will then provide the JSL into the application.  The documentation on the Application Builder shows examples on how this works.  See

     Help==>Books==>Scripting Guide

and then scan for Application Builder

Jim

View solution in original post

cwillden
Super User (Alumni)

Re: How to use Graph boxes in the JMP Application builder

Learning to script graph boxes has a bit of learning curve. You find a pretty good guide in the Scripting Guide (Help > Books > Scripting Guide).  There is a section called "Create New Graphs from Scratch" that talks about Graph Box().  The entries for "Custom Graph" and "Graphics" in the Scripting Index (also in the Help menu) has details on things you can do in Graph Box.

As with anything in JSL, there's a million ways to skin this cat in Application Builder, but each way is kinda tricky to figure out.  The Scripting Guide will tell you can write something like this:

Graph Box(
	Marker(
		Marker State( 3 ),
		[11 44 77],
		[75 25 50]
	)
)

The problem here is that when you drag a Graph Box out into your application, you don't have an opportunity to write the graphics script right there.  You just have a blank graph. You have to add the graphics script in your application script.

This is where it gets tricky.  Graph Box is really a container box for a bunch of display boxes that make up the graph.  The graphing area is a Frame Box.  You can add a graphics script to the frame box in your script like so:

x = [80 50 20];
y = [20 50 80];

winref = (this module instance << Get Box);

winref[framebox( 1 )] << Add Graphics Script( Marker( x, y ) );

Although, if you look at "Custom Graph" in the Scripting Index, you'll find a bunch of messages you can send to a Graph Box specifically.

For example, you can drag a graph box out into your application and let's say you name it "gb".  In the script for that module, I can add points with the following script:

gb << Set Graphics Script( Marker( x, y ) );
//or
gb << Append Seg( Marker Seg(x,y) );

This actually shows you 2 ways to add the points with Append Seg( Marker Seg()) and Set Graphics Script ( Marker()).  I prefer the "Set Graphics Script" approach.  I attached an example showing all the methods in Application Builder. 

As @txnelson pointed out, it's often easier to create this kind of plot in Graph Builder or something similar.  In Application Builder, you should see all your open reports at the top of the left pane.  You could then drag an existing graph builder report into your application.  The only issue here is that it's going to look for those exact column names from the data table when the app launches to populate the Graph Builder plot.

-- Cameron Willden

View solution in original post

12 REPLIES 12
txnelson
Super User

Re: How to use Graph boxes in the JMP Application builder

The typical method used for adding a graph into a JMP Application, is to first interactively create the required graph or plot using one of the JMP Platforms(i.e. Fit Y by X, Distributions, etc.) and then open the Application Builder, where you then will see the graph or plot, and you then can drag it into your application.  JMP will then provide the JSL into the application.  The documentation on the Application Builder shows examples on how this works.  See

     Help==>Books==>Scripting Guide

and then scan for Application Builder

Jim

Re: How to use Graph boxes in the JMP Application builder

I want to add a second to @txnelson's comment.  

 

Application Builder is designed to allow you to leverage existing capabilities in JMP. Fun Fact - Dashboard Builder is just a skin sitting on top of Application Builder, so all the drag and drop report generating you can do in Dashboard Builder can be done in Application Builder too.  

 

Unless you need to do something super specific, I'd just generate the plot I want in Graph Builder, then open up my Application Builder Source File.  The Graph Builder should show up in the left-hand pane towards the top.  Just drag it to where you want it in the GUI and you're off to the races.  You'll still need to parameterize the code but that's a lot easier than trying to hack a custom graph from scratch.

 

Best,

 

M

cwillden
Super User (Alumni)

Re: How to use Graph boxes in the JMP Application builder

Learning to script graph boxes has a bit of learning curve. You find a pretty good guide in the Scripting Guide (Help > Books > Scripting Guide).  There is a section called "Create New Graphs from Scratch" that talks about Graph Box().  The entries for "Custom Graph" and "Graphics" in the Scripting Index (also in the Help menu) has details on things you can do in Graph Box.

As with anything in JSL, there's a million ways to skin this cat in Application Builder, but each way is kinda tricky to figure out.  The Scripting Guide will tell you can write something like this:

Graph Box(
	Marker(
		Marker State( 3 ),
		[11 44 77],
		[75 25 50]
	)
)

The problem here is that when you drag a Graph Box out into your application, you don't have an opportunity to write the graphics script right there.  You just have a blank graph. You have to add the graphics script in your application script.

This is where it gets tricky.  Graph Box is really a container box for a bunch of display boxes that make up the graph.  The graphing area is a Frame Box.  You can add a graphics script to the frame box in your script like so:

x = [80 50 20];
y = [20 50 80];

winref = (this module instance << Get Box);

winref[framebox( 1 )] << Add Graphics Script( Marker( x, y ) );

Although, if you look at "Custom Graph" in the Scripting Index, you'll find a bunch of messages you can send to a Graph Box specifically.

For example, you can drag a graph box out into your application and let's say you name it "gb".  In the script for that module, I can add points with the following script:

gb << Set Graphics Script( Marker( x, y ) );
//or
gb << Append Seg( Marker Seg(x,y) );

This actually shows you 2 ways to add the points with Append Seg( Marker Seg()) and Set Graphics Script ( Marker()).  I prefer the "Set Graphics Script" approach.  I attached an example showing all the methods in Application Builder. 

As @txnelson pointed out, it's often easier to create this kind of plot in Graph Builder or something similar.  In Application Builder, you should see all your open reports at the top of the left pane.  You could then drag an existing graph builder report into your application.  The only issue here is that it's going to look for those exact column names from the data table when the app launches to populate the Graph Builder plot.

-- Cameron Willden
Saravana
Level II

Re: How to use Graph boxes in the JMP Application builder

Thank you cwillden for you reply,

 

But my requirement is something like, I should plot data in 2 columns of a table. Say, Instead of X and Y in your example, I should be able to plot a graph using 2 columns from a table. (For example I have values Level and Population as two columns in a data table "Detail", I should plot between Level and Population).

 

I tried in the same way as in your example like Result Graph << Set Graphics Script (Marker(Level, Population)); 

But I was not able to get the graph. Should I do anything extra to take data from table?

Re: How to use Graph boxes in the JMP Application builder

Can you provide a sample data table or maybe a prototype in graph builder of what you would like the plot to look like?

M
Saravana
Level II

Re: How to use Graph boxes in the JMP Application builder

Hi Anderson,

I have attached the screen shot of the application what i wish to create.

I have atached a sample table and script i have used to plot the graph. But I am getting only the empty graph while running. I am not getting the values form the table.

Dashboard Script.PNGDashboard.PNGGraph.PNGTable.PNG

cwillden
Super User (Alumni)

Re: How to use Graph boxes in the JMP Application builder

Hi @Saravana,

Yes, you need to store the values of the columns in vectors.  You can do that very easily with Col << Get Values.

For example, you can add this to the App Builder script I sent you earlier:

//Open Big Class Data Table
dt = Open("$Sample_Data/Big Class.jmp");

//Store height and weight in vectors
x= dt:Height << Get Values;
y= dt:Weight << Get Values;

//Graph the points
gb << Set Graphics Script( Marker( x, y ) );

//Modify X and Y axis
gb << Set X Axis( {Min(50), Max(70), Inc(5)});
gb << Set Y Axis( {Min(60), Max(150), Inc(10)});

This plots Weight vs. Height for the Big Class sample data table.

-- Cameron Willden
Saravana
Level II

Re: How to use Graph boxes in the JMP Application builder

Hi cwillden,

I am getting an error popup showing unknown when i try this.

cwillden
Super User (Alumni)

Re: How to use Graph boxes in the JMP Application builder

What is the error?  What code did you run?

-- Cameron Willden