Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- Variable limits to graph depending on the products

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 28, 2017 3:42 AM
(1194 views)

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

- Add reference line on graphbuilder 88 to 92
- Add reference line on graphbuilder 84 to 88
- Add reference line on graphbuilder 80 to 84

Any ideas how this could be done would be great.

6 REPLIES

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 28, 2017 5:58 AM
(1185 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 28, 2017 6:17 AM
(1178 views)

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Feb 28, 2017 6:40 AM
(1175 views)

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

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 )}
)
)
);
```

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 2, 2017 6:56 AM
(1119 views)

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 2, 2017 7:17 AM
(1115 views)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Mar 10, 2017 1:57 AM
(1058 views)

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 )
) )
)
```