cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
JMewborn
Level II

Creating an Interactive Pareto Plot with interactive Slider Boxes to update column formula

I have a set of specifications that a product in production would need to pass. I have a column with a formula that specifies the values needed (Limits) by each specification, and creates a binary pass/fail. This formula is used to create a Pareto Graph of passing number and percentage. I want to create an interactive Pareto Graph with slider boxes to adjust the testing limits, and see how changing these limits would change the amount of items passing/failing the test. 

 

My main two problems are as follows: 

1) There are multiple product types that will be tested. I wont have a consistent number of specifications per product, so I plan on inserting these specs into an list,(in the code attached that would be "spec") and using an external data table to fill in those specs for the desired product. This isn't something I need help with, but is something to consider as I will have to input slider boxes, number boxes, and so on in a for loop without directly referencing the variables. 

2) I need an array of variables (spec limits) so that I can update the formula for testing purposes. Again this will need to be in a for loop. As the script stands right now, it appears the values of spec limits are not updating the in the formula for the pass/fail column. When the slider box receives the <<  inval command and the graph refreshes, nothing is happening as the actual pass/fail column isn't updated. I'm currently using an associative array to store the spec limits. This may not be the correct way to do this. 

 

I have attached the sample data table I am using as well as the current script. Thanks!

 

Names default to here(1);
RangeMin = Associative array(["m1" => 0,
"m2" => 0,
"m3" => 0,
"thickness" => 0]);
RangeMax = Associative array(["m1" => 1,
"m2" =>1,
"m3" => 1,
"thickness" => 20]);
limit = Associative array(["m1" => 0.5,
"m2" => 0.5,
"m3" => 0,
"thickness" => 4]);

SliderVars = {0.5,0.5,0.5,10};

spec = {"m1","m2","m3","thickness"};
GraphingTable = current data table();

finalDisplay = New Window ("test", testlist = h list box());
:name("Pass/Fail") <<  Set Formula(
			if((:thickness >=  limit["thickness"] & :m3 >= limit["m3"] & m2 >= limit["m2"] & m1 >= limit["m1"]), "Pass", "Fail" )
			);
PP= Graphing Table << Pareto Plot( Cause( :"Pass/Fail"n ) );

ValuesOutlineBox = Outline Box ( "Values", SliderList = v list box());
For(i=1, i<= n items(spec),i++,

	SliderList << append(
		h list box(
			Text box(spec[i]),
			testing = spec[i];
			
			eval(
				parse(
					eval insert(
							"Var^char(i)^ = ^SliderVars[i]^;
							
							SB^char(i)^ = Slider Box(
							^RangeMin << get value(spec[i])^,
							^RangeMax << get value(spec[i])^,
							Var^char(i)^,
							NEB^char(i)^ << set( Var^char(i)^ );
							limit[testing] = Var^char(i)^;
							testlist[2] << Delete Box();
							wait(0.1);
							testlist << append(report(PP));
						);"
					);
				);
			),
			testing = spec[i];
			
			eval(
				parse(
					eval insert(
							"NEB^char(i)^ = Number Edit Box( Var^char(i)^,
								<< set function(
									Function( {this},
									Var^char(i)^ = this << get;
									SB^char(i)^ << inval;
									limit[testing] = Var^char(i)^;
									testlist[2] << Delete Box();
									wait(0.1);
									testlist << append(report(PP));	
									)
								)
								
								
							);"
							
					
					);
				);
			),
				
				
			
		)
	)
);

testlist << append(ValuesOutlineBox);
testlist << append(report(PP));
Josh
12 REPLIES 12
jthi
Super User

Re: Creating an Interactive Pareto Plot with interactive Slider Boxes to update column formula

I think the values should be save saved to specs associative array when you change them. But you could also try to save the references to number edit boxes to a list or other associative array. Or maybe you can use XPath (or some other means to travel the tree structure) to get those references when you need them.

-Jarmo
JMewborn
Level II

Re: Creating an Interactive Pareto Plot with interactive Slider Boxes to update column formula

It doesn't appear to be changing the specs array. That's what I thought initially at first too. However I was able to reference the individual boxes inside the V List Box.  I Appreciate your help as always.  

Josh
lwx228
Level VIII

Re: Creating an Interactive Pareto Plot with interactive Slider Boxes to update column formula

Thanks! Good example.