BookmarkSubscribe
Choose Language Hide Translation Bar
pauldeen
Community Trekker

sliders update a table that updates a graph

I'm trying to use sliders to update a table, then the models in the model columns update to predict new values (on a wafer map) which then redraws the contourplot. The problem is that when you turn automatic recalc on and append the sliders to the contourplot, the sliders get thrown out on recalc.

I can keep the sliders and the contourplot in seperate windows but then I have a problem if I work in a JMP project and I have to get into scripting the tab report layout.

I do not need to stay within a table - graph with sliders format, we could also do all of it in memory but I don't think that rebuilding the contourplot in code is fun. Graph builder is also fine as long as I can draw point maps.

The current solution in this new window() works but when moving the sliders I'm deleting and reattaching the updated contour plot which is a bit of a hack job and slow. So i'm looking for a better solution!

 

 Capture.PNG

Example table attached.

 

Example script attached and here:

Names default to here(1);
RangeMin = Associative array(["C flow" => 180,
"D flow" => 165,
"Time" => 33,
"Pressure" => 200,
"Temp" => 610,
"A flow" => 180,
"B flow" => 165]);
RangeMax = Associative Array(["C flow" => 355,
"D flow" => 325,
"Time" => 44,
"Pressure" => 350,
"Temp" => 630,
"A flow" => 355,
"B flow" => 450]);
SliderVars = {620.869565217391, 40.5217391304348, 268.478260869565, 263.260869565217,
288.913043478261, 271.086956521739, 247.608695652174, 263.43, 40.5217391304348,
268.478260869565, 263.260869565217, 288.913043478261, 271.086956521739,
247.608695652174, 620.869565217391, 40.5217391304348, 268.478260869565,
263.260869565217, 288.913043478261, 271.086956521739, 247.608695652174};
XColumns = {"Temp", "Time", "Pressure", "A flow", "B flow",
"C flow", "D flow"};
GraphingTable = Current Data Table();

sjaakie = New window("test", testlist = h list box());

CP = GraphingTable << Contour Plot(
	X( :X, :Y ),
	Y( :Models ),
	Show Data Points( 1 ),
	Fill Areas( 1 ),
	Label Contours( 0 ),
	Color Theme( "Spectral" ),
	Automatic Recalc( 1 )
);

ValuesOutlineBox = Outline Box("Values", SliderList = v list box());
For(i=1, i<= n items(XColumns),i++,
	SliderList << append(
		h list box(
			Text box(XColumns[i]),
			eval(
				parse(
					eval insert(
						"Var^char(i)^ = ^SliderVars[i]^;
						SB^char(i)^ = Slider Box(
							^RangeMin << get value(XColumns[i])^,
							^RangeMax << get value(XColumns[i])^,
							Var^char(i)^,
							NEB^char(i)^ << set( Var^char(i)^ );
							^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
							testlist[2] << Delete Box();
							wait(0.1);
							testlist << append(report(CP));
						);"
					);
				);
			),
			eval(
				parse(
					eval insert(
						"NEB^char(i)^ = Number Edit Box( Var^char(i)^,
							<<setfunction(
								Function( {this},
									Var^char(i)^ = this << get;
									SB^char(i)^ << inval;
									^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
									testlist[2] << Delete Box();
									wait(0.1);
									testlist << append(report(CP));
								)
							)
						);"
					);
				);
			),
		)
	)
);

testlist << append(ValuesOutlineBox);
testlist << append(report(CP));
sjaakie << Bring Window To Front();

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User

Re: sliders update a table that updates a graph

I've put the contourplot in a display box container and it seems to work ok.

 

Names default to here(1);
RangeMin = Associative array(["C flow" => 180,
"D flow" => 165,
"Time" => 33,
"Pressure" => 200,
"Temp" => 610,
"A flow" => 180,
"B flow" => 165]);
RangeMax = Associative Array(["C flow" => 355,
"D flow" => 325,
"Time" => 44,
"Pressure" => 350,
"Temp" => 630,
"A flow" => 355,
"B flow" => 450]);
SliderVars = {620.869565217391, 40.5217391304348, 268.478260869565, 263.260869565217,
288.913043478261, 271.086956521739, 247.608695652174, 263.43, 40.5217391304348,
268.478260869565, 263.260869565217, 288.913043478261, 271.086956521739,
247.608695652174, 620.869565217391, 40.5217391304348, 268.478260869565,
263.260869565217, 288.913043478261, 271.086956521739, 247.608695652174};
XColumns = {"Temp", "Time", "Pressure", "A flow", "B flow",
"C flow", "D flow"};
GraphingTable = Current Data Table();

sjaakie = New window("test", testlist = h list box());

CPcontent = VListBox(
	GraphingTable << Contour Plot(
		X( :X, :Y ),
		Y( :Models ),
		Show Data Points( 1 ),
		Fill Areas( 1 ),
		Label Contours( 0 ),
		Color Theme( "Spectral" ),
		Automatic Recalc( 1 )
	)
);

ValuesOutlineBox = Outline Box("Values", SliderList = v list box());

For(i=1, i<= n items(XColumns),i++,
	SliderList << append(
		h list box(
			Text box(XColumns[i]),
			eval(
				parse(
					eval insert(
						"Var^char(i)^ = ^SliderVars[i]^;
						SB^char(i)^ = Slider Box(
							^RangeMin << get value(XColumns[i])^,
							^RangeMax << get value(XColumns[i])^,
							Var^char(i)^,
							NEB^char(i)^ << set( Var^char(i)^ );
							^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
						);"
					);
				);
			),
			eval(
				parse(
					eval insert(
						"NEB^char(i)^ = Number Edit Box( Var^char(i)^,
							<<setfunction(
								Function( {this},
									Var^char(i)^ = this << get;
									SB^char(i)^ << inval;
									^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
								)
							)
						);"
					);
				);
			),
		)
	)
);


testlist << append(ValuesOutlineBox);
testlist << append(CPcontent);

 

-Dave
4 REPLIES 4
David_Burnham
Super User

Re: sliders update a table that updates a graph

You might want to come up with a more trivial example based on a standard data table that we all have access to, then we can have some code that we can run and comment on.

-Dave
0 Kudos
David_Burnham
Super User

Re: sliders update a table that updates a graph

I've put the contourplot in a display box container and it seems to work ok.

 

Names default to here(1);
RangeMin = Associative array(["C flow" => 180,
"D flow" => 165,
"Time" => 33,
"Pressure" => 200,
"Temp" => 610,
"A flow" => 180,
"B flow" => 165]);
RangeMax = Associative Array(["C flow" => 355,
"D flow" => 325,
"Time" => 44,
"Pressure" => 350,
"Temp" => 630,
"A flow" => 355,
"B flow" => 450]);
SliderVars = {620.869565217391, 40.5217391304348, 268.478260869565, 263.260869565217,
288.913043478261, 271.086956521739, 247.608695652174, 263.43, 40.5217391304348,
268.478260869565, 263.260869565217, 288.913043478261, 271.086956521739,
247.608695652174, 620.869565217391, 40.5217391304348, 268.478260869565,
263.260869565217, 288.913043478261, 271.086956521739, 247.608695652174};
XColumns = {"Temp", "Time", "Pressure", "A flow", "B flow",
"C flow", "D flow"};
GraphingTable = Current Data Table();

sjaakie = New window("test", testlist = h list box());

CPcontent = VListBox(
	GraphingTable << Contour Plot(
		X( :X, :Y ),
		Y( :Models ),
		Show Data Points( 1 ),
		Fill Areas( 1 ),
		Label Contours( 0 ),
		Color Theme( "Spectral" ),
		Automatic Recalc( 1 )
	)
);

ValuesOutlineBox = Outline Box("Values", SliderList = v list box());

For(i=1, i<= n items(XColumns),i++,
	SliderList << append(
		h list box(
			Text box(XColumns[i]),
			eval(
				parse(
					eval insert(
						"Var^char(i)^ = ^SliderVars[i]^;
						SB^char(i)^ = Slider Box(
							^RangeMin << get value(XColumns[i])^,
							^RangeMax << get value(XColumns[i])^,
							Var^char(i)^,
							NEB^char(i)^ << set( Var^char(i)^ );
							^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
						);"
					);
				);
			),
			eval(
				parse(
					eval insert(
						"NEB^char(i)^ = Number Edit Box( Var^char(i)^,
							<<setfunction(
								Function( {this},
									Var^char(i)^ = this << get;
									SB^char(i)^ << inval;
									^Column(GraphingTable, XColumns[i])^ << set values(J(n rows(),1,Var^char(i)^));
								)
							)
						);"
					);
				);
			),
		)
	)
);


testlist << append(ValuesOutlineBox);
testlist << append(CPcontent);

 

-Dave
Highlighted
David_Burnham
Super User

Re: sliders update a table that updates a graph

FYI

 

when you are using the eval(parse(evalinsert( ... ))) construction you don't need to "char" the variables.  So you can write 

SB^i^ = Slider Box( . . . )

the content is already a string, so the char is redundant.

-Dave
pauldeen
Community Trekker

Re: sliders update a table that updates a graph

Yeah artifact from another technique that I tried first, thanks for your help!
0 Kudos