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
- :
- How to Apply Limits from Array to a graph?

- 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

Aug 30, 2016 7:47 AM
(7230 views)

I have 2 files, "spec" and "Data". The data has FAI, and Points (PT). I want to run a Analysis -> Quality Process -> Variability chart and automatically apply the spec for each FAI to the charts.

On some occasions i can get the Limits array to apply using below code but it is inconsistent

If i change the limits to a static value, it would work fine.

1) I'm looking for any help the community can provide

2) If there are more elegant solution, i'm also would like to know.

**Example Code Below**

=====================

close all **(**data tables, nosave**)**; clear symbols**()**; delete symbols**()**;

// Create stacked Data Table: these are just examples, i know how to read as a file

dtDataStacked = new table **(**"dtDataStacked"**)**;

dtDataStacked << **New Column****(**"FAI",Character,values**({**"01","02","02","03","03","03"**}))**;

dtDataStacked << **New Column****(**"PT",Character,values**({**"A","A","B","A","B","B"**}))**;

dtDataStacked << **New Column****(**"Value",values**({****1**,**1**,**2**,**1**,**2**,**3****}))**;

dtSpecStacked = new table **(**"dtSpecStacked"**)**;

dtSpecStacked << **New Column****(**"_FAI",Character,values**({**"01","02","03"**}))**;

dtSpecStacked << **New Column****(**"_LSL",numeric,Continious,values**({****0**,**0**,**0****}))**;

dtSpecStacked << **New Column****(**"_USL",numeric,Continious,values**({****4**,**4**,**4****}))**;

// assign limits to stackedData

dtDataStacked << **update****(**

with **(**dtSpecStacked**)**,

Match Columns**(**FAI = _FAI**)**

**)**;

// Making Plots

current data table **(**dtDataStacked**)**;

dtDataStacked << **Variability Chart****(**

Y**(** :Value **)**,

X**(** :PT **)**,

By**(** :FAI**)**,

Analysis Type**(** "Choose best analysis (EMS REML Bayesian)" **)**,

Connect Cell Means**(** **1** **)**,

Std Dev Chart**(** **0** **)**,

Points Jittered**(** **1** **)**,

Show Box Plots**(** **1** **)**,

SendToReport**(**

Dispatch**(**

**{**"Variability Chart for Value"**}**,

"2",

ScaleBox,

**{**

// Add Ref Line( {0, 4}, "Solid", "Dark Green","", 1, 0.25 ) // this line works

Add Ref Line**(** **{**_lsl, _usl**}**, "Solid", "Dark Green","", **1**, **0.25** **)** /// this line does not

**}**

**)**

**)**

**)**;

1 ACCEPTED SOLUTION

Accepted Solutions

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

Here is a slightly different version that adds the reference lines to the charts after the charts are created

//close all (data tables, nosave); clear symbols(); delete symbols();

// Create stacked Data Table: these are just examples, i know how to read as a file

dtDataStacked = new table ("dtDataStacked2");

dtDataStacked << New Column("FAI",Character,values({"01","02","02","03","03","03"}));

dtDataStacked << New Column("PT",Character,values({"A","A","B","A","B","B"}));

dtDataStacked << New Column("Value",values({1,1,2,1,2,3}));

dtSpecStacked = new table ("dtSpecStacked");

dtSpecStacked << New Column("_FAI",Character,values({"01","02","03"}));

dtSpecStacked << New Column("_LSL",numeric,Continious,values({0,0,0}));

dtSpecStacked << New Column("_USL",numeric,Continious,values({4,4,4}));

// assign limits to stackedData

dtDataStacked << update(

with (dtSpecStacked),

Match Columns(FAI = _FAI)

);

// Making Plots

current data table (dtDataStacked);

varch = dtDataStacked << Variability Chart(

Y( :Value ),

X( :PT ),

By( :FAI),

Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

Connect Cell Means( 1 ),

Std Dev Chart( 0 ),

Points Jittered( 1 ),

Show Box Plots( 1 )/*,

SendToReport(

Dispatch(

{"Variability Chart for Value"},

"2",

ScaleBox,

{

// Add Ref Line( {0, 4}, "Solid", "Dark Green","", 1, 0.25 ) // this line works

Add Ref Line( {_LSL, _USL}, "Solid", "Dark Green","", 1, 0.25 ) /// this line does not

}

)

)*/

);

// Add the reference lines to each of the charts

For(i=1,i<=N Rows(dtSpecStacked),i++,

report(varch*)[axisbox (*1)]<<Add Ref Line( dtSpecstacked:_LSL[i], "Solid", "Dark Green","", 1 );

report(varch*)[axisbox (*1)]<<Add Ref Line( dtSpecstacked:_USL[i], "Solid", "Dark Green","", 1 );

);

Jim

8 REPLIES 8

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

Re: How to Apply Limits from Array to a graph?

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

Re: How to Apply Limits from Array to a graph?

kindly see notes below...

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

Re: How to Apply Limits from Array to a graph?

JMP has the builtin capability of displaying spec limits if the limits have been saved as column properties. Below is a modification of your script that uses this methodology

close all (data tables, nosave); clear symbols(); delete symbols();

// Create stacked Data Table: these are just examples, i know how to read as a file

dtDataStacked = new table ("dtDataStacked2");

dtDataStacked << New Column("FAI",Character,values({"01","02","02","03","03","03"}));

dtDataStacked << New Column("PT",Character,values({"A","A","B","A","B","B"}));

dtDataStacked << New Column("Value",values({1,1,2,1,2,3}));

dtSpecStacked = new table ("dtSpecStacked");

dtSpecStacked << New Column("_FAI",Character,values({"01","02","03"}));

// Add the spec limits as column properties to your column "Value"

dtDataStacked:value << set property("Spec Limits",{LSL(0),USL(4),show limits(1)});

/*

dtSpecStacked << New Column("_LSL",numeric,Continious,values({0,0,0}));

dtSpecStacked << New Column("_USL",numeric,Continious,values({4,4,4}));

*/

// assign limits to stackedData

dtDataStacked << update(

with (dtSpecStacked),

Match Columns(FAI = _FAI)

);

// Making Plots

current data table (dtDataStacked);

dtDataStacked << Variability Chart(

Y( :Value ),

X( :PT ),

By( :FAI),

Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

Connect Cell Means( 1 ),

Std Dev Chart( 0 ),

Points Jittered( 1 ),

Show Box Plots( 1 )

/*,

SendToReport(

Dispatch(

{"Variability Chart for Value"},

"2",

ScaleBox,

{

// Add Ref Line( {0, 4}, "Solid", "Dark Green","", 1, 0.25 ) // this line works

Add Ref Line( {_LSL, _USL}, "Solid", "Dark Green","", 1, 0.25 ) /// this line does not

}

)

)*/

);

Jim

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

Re: How to Apply Limits from Array to a graph?

kindly see notes below...

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

Re: How to Apply Limits from Array to a graph?

Apologies for not making the example representative of my issue.

Suppose the limits are different by FAI. and** **I would like to understand how each PT performs within the same FAI.

The initial "dtDataStacked" is basically the result of stacked data which originally had the FAI, PT, Value all in different columns. I recall the requirement for Variable Gauge chart is you must stack them first to hence the dtSpecStacked.

**Kindly review the original Code lines to below to illustrate my issue...**

dtSpecStacked << **New Column****(**"_LSL",numeric,Continious,values**({****0**,**0**,**0****}))**;

dtSpecStacked << **New Column****(**"_USL",numeric,Continious,values**({****4**,**5**,**7****}))**;

So

FAI = 01 has limits of 0~4

FAI = 02 has limits of 0~5

FAI = 03 has limits of 0~7

... etc

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

Here is a slightly different version that adds the reference lines to the charts after the charts are created

//close all (data tables, nosave); clear symbols(); delete symbols();

// Create stacked Data Table: these are just examples, i know how to read as a file

dtDataStacked = new table ("dtDataStacked2");

dtDataStacked << New Column("FAI",Character,values({"01","02","02","03","03","03"}));

dtDataStacked << New Column("PT",Character,values({"A","A","B","A","B","B"}));

dtDataStacked << New Column("Value",values({1,1,2,1,2,3}));

dtSpecStacked = new table ("dtSpecStacked");

dtSpecStacked << New Column("_FAI",Character,values({"01","02","03"}));

dtSpecStacked << New Column("_LSL",numeric,Continious,values({0,0,0}));

dtSpecStacked << New Column("_USL",numeric,Continious,values({4,4,4}));

// assign limits to stackedData

dtDataStacked << update(

with (dtSpecStacked),

Match Columns(FAI = _FAI)

);

// Making Plots

current data table (dtDataStacked);

varch = dtDataStacked << Variability Chart(

Y( :Value ),

X( :PT ),

By( :FAI),

Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),

Connect Cell Means( 1 ),

Std Dev Chart( 0 ),

Points Jittered( 1 ),

Show Box Plots( 1 )/*,

SendToReport(

Dispatch(

{"Variability Chart for Value"},

"2",

ScaleBox,

{

// Add Ref Line( {0, 4}, "Solid", "Dark Green","", 1, 0.25 ) // this line works

Add Ref Line( {_LSL, _USL}, "Solid", "Dark Green","", 1, 0.25 ) /// this line does not

}

)

)*/

);

// Add the reference lines to each of the charts

For(i=1,i<=N Rows(dtSpecStacked),i++,

report(varch*)[axisbox (*1)]<<Add Ref Line( dtSpecstacked:_LSL[i], "Solid", "Dark Green","", 1 );

report(varch*)[axisbox (*1)]<<Add Ref Line( dtSpecstacked:_USL[i], "Solid", "Dark Green","", 1 );

);

Jim

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

Re: How to Apply Limits from Array to a graph?

I modified my last entry, to read the specs from the dtSpecstacked data table, and to just add the limits from row one to chart one, row two to chart two, etc.

Jim

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

Re: How to Apply Limits from Array to a graph?