Subscribe Bookmark RSS Feed

Variable limits to graph depending on the products

DKI

Occasional Contributor

Joined:

Feb 13, 2017

Hi

 

Thanks for reading.

Dot plots which are generated in JSL using graph builder.

I am trying to get SQL search a product column and for each product to return a reference line on a graph for the appropriate limits for that product.

 

Example:

If product                  Then

  1.                         Add reference line on graphbuilder 88 to 92
  2.                         Add reference line on graphbuilder 84 to 88
  3.                         Add reference line on graphbuilder 80 to 84

Any ideas how this could be done would be great.

 

 

 

6 REPLIES
M_Anderson

Staff

Joined:

Nov 21, 2014

If you just want control limits (i.e. calculated by JMP) you can just us the "phase" area in the control chart builder.  Stack your data with a column that denotes which subset of data each data point comes from and then put that column into the phase area of the control chart builder.  

DKI

Occasional Contributor

Joined:

Feb 13, 2017

Thanks for the reply.

 

It is not really limit calculation I am looking for. I have the limits for each of the products. Based off the product JMP finds in the product column I would like the graph to have reference lines added at the particular spec'd limits for that product.

 

In graph builder I would normally add a reference line by right clicking the axis then selecting axis settings, and adding a reference line. I would like the value of this axis line to change depending on the product.

 

I would imagine an If statement could do this but am not sure how to make that work.

 

i.e. if product 1 then add reference line at 88 & 84, elseif product 2 then add reference line at 84 & 80

ian_jmp

Staff

Joined:

Jun 23, 2011

I'm not completely sure, but I think you are after something like this (where 'sex' plays the role of 'product');

 

Screen Shot 2017-02-28 at 14.35.46.png

As you know, axis reference lines won't do it because (by design) these are the same across all cells in the trellis plot that Graph Builder produces (to facilitate comparisons). So you may have to resort to graphics scripts to draw horizontal lines:

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Graph Builder(
	Size( 564, 452 ),
	Show Control Panel( 0 ),
	Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( :height ), Group Y( :sex ), Color( :sex ) ),
	Elements( Points( X, Y, Legend( 22 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Add Graphics Script(
				2,
				Description( "Script" ),
				Pen Color( "Blue" );
				H Line( 60 );
				H Line( 65 );
			), Add Graphics Script( 3, Description( "Script" ), Empty() ), Grid Line Order( 1 ),
			Reference Line Order( 4 )}
		),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox( 2 ),
			{Add Graphics Script(
				2,
				Description( "Script" ),
				Pen Color( "Red" );
				H Line( 60 );
				H Line( 55 );
			), Grid Line Order( 1 ), Reference Line Order( 3 )}
		)
	)
);
DKI

Occasional Contributor

Joined:

Feb 13, 2017

Hi Ian

Thanks for the suggestion. This script appears to be adding lines at set values.

I am looking at something similar but I would like the values of at which the lines are placed to change conditionally on what product number the script finds in the Product collumn

 

i.e.

If Product 1                              then the reference lines get inserted at limit values 3 and 4

If product  2                             then the reference lines get inserted at limit values 5 and 6

 

I would like the quiry to esentially do a Vlookup (appologies for the excel term) and based off the values it finds to set the limits

ian_jmp

Staff

Joined:

Jun 23, 2011

That's easy enough to do. But the details would depend on exactly how you have the data stored, and the meta-data (limits) for each product. Maybe you can post an example JMP file?

phil_kay

Staff

Joined:

Jul 22, 2014

Hi,

 

I've seen other JMP users manage this by having a column each for upper and lower limit. Then plot these as overlayed variables on the graph (uses the connecting line graph element).

 

In their case they had these columns in their database. i.e. the upper and lower limits are recorded with every result.

 

However, you could easily add these as new formula columns with IF statements to yield the different limits by product. The code for adding formula columns is pretty simple. And it could easily be added as post-query script in JMP's SQL Query Builder.

 

dt = Current Data Table();
dt << New Column ( "Upper",
Numeric,
Continuous, 
Formula ( If( :Product == "A",
92,
If( :Product == "B", 88, 84 )
) )
)