Turn on suggestions

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

Showing results for

- JMP User Community
- :
- Discussions
- :
- Allow ranges in graph builder

- 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
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Allow ranges in graph builder

Oct 25, 2019 6:30 AM
(812 views)

Hi,

When changing the X-axis settings in a graph is it possible to use the Allow Ranges and picking values based on the data set (in a script)? Or can this only be manually?

I´m trying to produce a plot with colour coded ranges (that are chosen from the data set), like a control chart but on the x-axis.

Br Julie

4 REPLIES 4

Highlighted
##

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

Re: Allow ranges in graph builder

The easiest way to find out what the JSL to add such an option such as the "Allow Ranges" is to interactively run the graph, adding the option you want(Allow Ranges) and then to save the script from the graph. Here is a graph with Allow Ranges

and here is the script generated from the graph

```
Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ),
SendToReport(
Dispatch(
{},
"weight",
ScaleBox,
{Add Ref Line( {119.84, 130}, "Solid", "Black", "", 1, 0.25 )}
)
)
);
```

And here is a modification to that script into a form that is more programmically easy to work with

```
gb = Graph Builder(
Variables( X( :weight ), Y( :height ) ),
Elements( Points( X, Y, Legend( 3 ) ), Smoother( X, Y, Legend( 4 ) ) ));
report(gb)[AxisBox(1)]<<Add Ref Line( {119.84, 130}, "Solid", "Black", "", 1, 0.25 );
```

Jim

Highlighted
##

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

Re: Allow ranges in graph builder

Actually my ranges will differ from dataset to dataset so I´m trying to figure out how to have the ranges in the graph added based on limits in the data set and not one set of ranges. So basically, in the code where it says:

`report(gb)[AxisBox(1)]<<Add Ref Line( {119.84, 130}, "Solid", "Black", "", 1, 0.25 );`

Can you have references to specific data point instead of actual numbers (e.g.: dt(:lower limit, :upper limit) instead of `119.84, 130`

)?

Highlighted
##

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

Re: Allow ranges in graph builder

Hi @JulieSAppel,

You should be able to replace the actual number, e.g. 119.84 with something like Eval(Col Min(:Column)) and the max with something like Eval(Col Max(:Column2)).

I did a quick test on one of my data tables, and this works. If the column is "lower limit", you might have to do something like

Eval(Col Min(:Name("lower limit"))). You might need to adjust the ticks in the JSL code to make for a more appealing graph, but I think an approach like this might work.

I'm sure @txnelson should be able to confirm if my approach is valid.

Hope this helps!,

DS

Highlighted
##

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

Re: Allow ranges in graph builder

Below is the code that I used to add in the range value

```
names default to here(1);
dt=open("$SAMPLE_DATA/semiconductor capability.jmp");
gb = Graph Builder(
Size( 534, 456 ),
Show Control Panel( 0 ),
Variables( X( :PNP1 ), Y( :NPN1 ) ),
Elements( Points( X, Y, Legend( 3 ) ) )
);
Eval(
Substitute(
Expr(
Report( gb )[AxisBox( 1 )] << Add Ref Line( {__LSL__, __USL__}, "Solid", "Black", "", 1, 0.25 )
),
Expr( __LSL__ ), (dt:PNP1 << get property( "spec limits" ))["LSL"],
Expr( __USL__ ), (dt:PNP1 << get property( "spec limits" ))["USL"]
)
);
```

Jim