Choose Language Hide Translation Bar
Highlighted

how to update value of line in bivariate

Hello all,

I try to write a script in JSL, which creates a new window that contains bivariate and changes the value of the line in the y-axis from a value of 5 to a value of 40 by pressing the OK button.
That is, the bivarite is displayed in a new window with a line of about 5, and after pressing the "OK" button, the line changes from 5 to 40, in the same window !!
I add the code I wrote, it brings up the new window and creates the bivariate with the line about 5 but can not change the value of the line by clicking.

Thanks to all the helpers!

 

 

TEST = open("C:\Users\shimi\Desktop\WP\TESTS\test refrsh.jmp","private");
TEST_V = 5;
New Window( "Inval example",
Button Box( "OK",
TEST_V=40;
g1 << inval; /* tell the oval to redraw */
g1 << update;
x = Tick Seconds();
While( Tick Seconds() - x < .5, 0 /* delay without wait(.5) */ );
),

g1 =TEST << Bivariate(
	Y( :nean ),
	X( :time ),
	SendToReport(
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Add Ref Line( TEST_V, "Solid", "Purple", "TEST", 2 )}
		)
	)
)
);

 

10 REPLIES 10
Highlighted

Re: how to update value of line in bivariate

Using the Send To Report() directive is a way for JMP to save a script that includes any modifications you made. It is not generally intended for scripting. A better way is to use a reference to the object (display box) to send a specific message. This example illustrates one way to manage reference lines by a script.

 

Names Default to Here( 1 );

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

biv = dt << Bivariate(
	Y( :weight ),
	X( :height )
);

biv rep = biv << Report;

biv rep[AxisBox( 2 )] << Add Ref Line( 55 );

Wait( 2 );

biv rep[AxisBox( 2 )] << Remove Ref Line( 55 );
biv rep[AxisBox( 2 )] << Add Ref Line( 65 );
Learn it once, use it forever!
Highlighted

Re: how to update value of line in bivariate

Hey,
I do not know why but when I try to take the code you wrote to my code my code does not work.
You may have another idea how to do it?

Highlighted

Re: how to update value of line in bivariate

I do not know why your code does not work either. I do not know how you incorporated my solution into your code.

 

I do not know another way. Even if there is another way, you might try to debug your script and fix it instead of looking for another way.

Learn it once, use it forever!
Highlighted

Re: how to update value of line in bivariate

This is the relevant part of the code I wrote with your solution,
I'd love to see if you see a problem that pops up to your eye.

 

	Layer_Charts = vlistbox(Outline Box(Layer),biv = dt_LTK__Sum << 
	Bivariate(
		Y( :Name( "Mean(RAW_VALUE)" ) ),
		X( :lot_data_collect_date ),
	SendToReport(
		Dispatch( {}, "1", ScaleBox, {Rotated Labels( "Angled" )} ),
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Min( Eval(CL - Dl*(1+ig)) ), Max( Eval(CL + Du*(1+ig))), Inc( Eval((UCL-LCL)/3 )),
			Add Ref Line( Eval(CL), Solid, "Red", "CL", 1 ),
			Add Ref Line( Eval(UCL), Dotted, "Red", "UCL", 1 ),
			Add Ref Line( Eval(LCL), Dotted, "Red", "LCL", 1 )}
		),
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Row Legend(
				ENTITY,
				Color( 1 ),
				Color Theme( "JMP Default" ),
				Marker( 1 ),
				Marker Theme( "Standard" ),
				Continuous Scale( 0 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)

);
Spacer Box( size( 1, 10 ) ), // a little vertical space
Spacer Box( size( 1, 10 ) ), // a little vertical space
H List Box( Text Box( "enter NEW CL: " ), Spacer Box( size( 3, 1 ) ), theBinNumber = Number Edit Box() ,Spacer Box( size( 15, 1 ) )),
Spacer Box( size( 1, 10 ) ), // a little vertical space
Spacer Box( size( 1, 10 ) ),
biv rep = biv << Report;

	Button Box( "OK",
		NEW_CL = theBinNumber << get;
		NEW_UCL =  NEW_CL + Du;
		NEW_LCL= NEW_CL -Dl;
		biv rep[AxisBox( 2 )] << Add Ref Line( Eval(NEW_CL), Dotted, "Purple",( "NEW CL = [" || char(NEW_CL) || "]  " ), 2);
		biv rep[AxisBox( 2 )] << Add Ref Line( Eval(NEW_UCL), Dotted, "Purple", ( "NEW UCL = " || char(NEW_UCL) || "  " ), 2);
		biv rep[AxisBox( 2 )] << Add Ref Line( Eval(NEW_LCL), Dotted, "Purple", ( "NEW LCL = " || char(NEW_LCL) || "  " ), 2);
		biv rep[AxisBox( 1 )] << Add Ref Line(  informat(date_RR << get text;); ;, "Dashed", "Green", "RR", 2);
Highlighted

Re: how to update value of line in bivariate

I have a few tabs, every tab I have Bivariate.
Can you please tell me do i need to change uh if i have some tabs with Bivariate in each of them?
Can you send me a solution that answers the problem with a few tabs?

Highlighted
txnelson
Super User

Re: how to update value of line in bivariate

Here is a very simple example, that creates 2 tabs, and then when a button box() is pushed, it generates a reference line for the tab whee the button was pushed

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/big class.jmp" );

nw = New Window( "Example", tab = Tab Box() );

For( i = 1, i <= 2, i++,
	Eval(
		Substitute(
				Expr(
					tab << Insert(
						i,
						"Graph " || Char( i ),
						Tab Page Box(
							__biv__ = bivariate( x( :height ), y( :weight ) ),
							__bb__ = Button Box( "Push Me",
								__biv__rep__ << Add Ref Line(
									100,
									Dotted,
									"Purple",
									"100",
									2
								)
							)
						)
					)
				),
			Expr( __biv__ ), Parse( "Biv" || Char( i ) ),
			Expr( __bb__ ), Parse( "bb" || Char( i ) ),
			Expr( __biv__rep__ ), Parse( "report(biv" || Char( i ) || ")[axisbox(1)]" )
		)
	)
);
Jim
Highlighted

Re: how to update value of line in bivariate

It does'nt work...

Highlighted
txnelson
Super User

Re: how to update value of line in bivariate

What version of JMP are you using?  My script works in JMP 13 & 14, but does not work in versions older than that.

Jim
Highlighted

Re: how to update value of line in bivariate

Jmp12
Article Labels

    There are no labels assigned to this post.