BookmarkSubscribeRSS Feed
David_

Occasional Contributor

Joined:

May 23, 2018

Bar Graph - Stacking Multiple Columns with Discrete Categories

 

I'm trying to determine RFT of parts based on the value against spec limits. I've been able to create custom transform columns in the graph builder using the following JSL script:

 

vars = expr(Variables());

dataSheet = "....CENSORED.jmp";
dt = Open(dataSheet);
colnames = dt << get column group( "Data" );

For( i = 1, i <= nitems(colnames), i++,
	
	colName = Char(colnames[i]);
	
	insert into(vars, 
		eval expr( 
			X(
				Transform Column(
					expr(char(colName)),
					Character,
					Nominal,
					Formula(
						lsl = (expr(parse(colName)) << get property( "Spec Limits" ))["LSL"];
						usl = (expr(parse(colName)) << get property( "Spec Limits" ))["USL"];
						If( expr(parse(colName)) < lsl | expr(parse(colName)) > usl,
							"Bad",
							"Good"
						);
					)
				)
			)	
		)  
	);	
);

gb = Eval Expr(
	Graph Builder(
		Show Control Panel( 1 ),
		Expr( Name Expr( vars ) )
	)
);

for(j = 1, j <= nitems(colNames), j++,
	insert into(gb,
		eval expr(
			Elements(
				Position( expr(j), 1 ),
				Bar(
					X,
					Legend( 3 ),
					Bar Style( "Stacked" ),
					Summary Statistic( "% of Total" )
				)
			)
		)
	);
);

gb;

This produces a virtual column for each column in the table with "Good" or "Bad" depending whether that feature was outside the spec limits. The problem is when I plot this using the Bar Chart I can't get the columns to stack:

 

Capture.PNG

 

What I'd like to see is something like this:

RFT.png

 

I can't see a way of doing this without losing connection to the original data table (ie, creating a summary style table that calculates the good/bad percentage separately)!

 

Help!

4 REPLIES
cwillden

Community Trekker

Joined:

May 1, 2017

Re: Bar Graph - Stacking Multiple Columns with Discrete Categories

Have you tried a mosaic plot?

-- Cameron Willden
David_

Occasional Contributor

Joined:

May 23, 2018

Re: Bar Graph - Stacking Multiple Columns with Discrete Categories

Unfortunately the Mosaic function doesn't work either:

Capture.PNG

 

David_

Occasional Contributor

Joined:

May 23, 2018

Re: Bar Graph - Stacking Multiple Columns with Discrete Categories

Capture.PNG 

So Mosaic might work, as demonstrated with this test data, but the direction of the bars in incorrect. There's no option to change this direction that I can see of

cwillden

Community Trekker

Joined:

May 1, 2017

Re: Bar Graph - Stacking Multiple Columns with Discrete Categories

You need to get your data into the correct format.  I'm guessing you want a separate bar for FT1 and FT2, right?  You need to stack those columns (Tables > Stack).  Almost everything in JMP needs to be in long format.  I started with your table from the screen shot and produced this:Mosaic.PNG

 

-- Cameron Willden