cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
itzikd
Level II

JSL replaceing a frame box based on check box

this is my code

 

dt = Current Data Table();

listX = {"X"};
listY = {"Y1"};

bivExpr = Expr(
	biv = Bivariate( Y( Eval List( listY ) ), X( Eval List( listx ) ) )
);
	

yListSelect = {"Y1", "Y2","Y3","Y4"};
	
BC_Indicator = Panel Box( "Choose",
	indicatorSelected = Radio Box(
		yListSelect,
		listY = {};
		Insert Into( listY, indicatorSelected << Get Selected );
		//selecting a checkbox creates the new graph based on the new Y
		bivExpr;
	)
);
	
nw = New Window( "test",
	H List Box(
		obj = dt << Bivariate(
			Y( Eval List( listY ) ),
			X( Eval List( listX ) ),
			Fit Spline( 0.1, standardized ),
			SendToReport(
				Dispatch(
					{},
					"Bivar Plot",
					FrameBox,
					{Frame Size( 493, 354 ), Marker Size( 2 ), Marker Drawing Mode( "Normal" ), Transparency( transparencyLegend ),
					Row Legend(
						dt:(fitVar),
						Color( 1 ),
						Color Theme( "JMP Default" ),
						Marker( 0 ),
						Marker Theme( "Standard" ),
						Continuous Scale( Cont ),
						Reverse Scale( 0 ),
						Excluded Rows( 0 )
					)}

				)
			)
		), 
           
   		BC_Indicator
	)
);

My data table

 

XY1Y2Y3Y4
160.589319416.790120.4987537.26817
160.222823420.48780.7389164.466501
159.507224015.533980.4889985.159705
160.0626811.270981.2135924.600484
160.966823017.359410.24575.867971
159.396922219.082130.9803928.845209
161.007822321.197010.756.766917
159.695720121.446380.2518899.343434
159.53923718.905470.4987539
160.943821016.381420.4926119.605911
160.269322919.117650.2475258.188586
160.679322017.073171.2315276.157635
161.891118721.621620.495059.158416
162.62820120.823240.97799510.51345
162.890919220.48780.49146.896552
163.016221218.795180.2433097.073171
160.828320617.031630.4901968.557457
160.319120822.871050.4901967.823961
160.326522219.951341.4669939.046455
160.270622718.427520.7407416.947891
162.888618618.858560.2506277.537688
162.863118923.614460.7281557.055961
161.195324116.341460.4926118.108108
161.275623912.315270.4926115.707196
160.110724716.666670.4878055.121951
161.36820119.852940.7389166.451613
161.224621820.197040.495057.5
160.014521523.114360.7352948.148148
161.657614918.151820.3355710.10101
159.594324814.563110.49146.356968
159.864718222.807021.77215210.07557
160.342322713.138690.2444997.090465
161.788824116.425120.4842625.326877
162.018821920.432690.9732367.729469

 

If you run the script you can see that when selecting a check box it will open a new window with the X by Y 

itzikd_0-1622635331062.png

 

I'm trying to understand how can I replace the graph in the current window and also add all the details like spline line, markers and etc...

I tried looking at the "tree structure" but not sure how to replace the "framebox(1)"

 

thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: JSL replaceing a frame box based on check box

The best way to handle what you are wanting, is to use a Column Switcher

choose.PNG

names default to here(1);
dt = Current Data Table();

Bivariate(
	Y( :Y4 ),
	X( :X ),
	Fit Spline( 0.1, Standardized, {Line Color( {212, 73, 88} )} ),
	Fit Spline( 10000, {Line Color( {61, 174, 70} )} ),
	Column Switcher( :Y4, {:Y1, :Y2, :Y3, :Y4} ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Frame Size( 444, 359 ), Marker Size( 6 ),
			Marker Drawing Mode( "Normal" ), Transparency( 0.5 ),
			Row Legend(
				Y2,
				Color( 1 ),
				Color Theme( "Blue to Gray to Red" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 1 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

It allows one to interactively make changes to the graph, and then when a new column is selected all of the changes are applied to the new column.

If you still want to do this not using the Column Switcher, what you need to do, is in your Radio Box, when a new selection is made, you extract the Script for the Bivariate, and then parse the script, replacing the the old column name, with the new column name, delete the old Bivariate report, and then run the newly modified script.

Jim

View solution in original post

5 REPLIES 5
txnelson
Super User

Re: JSL replaceing a frame box based on check box

The best way to handle what you are wanting, is to use a Column Switcher

choose.PNG

names default to here(1);
dt = Current Data Table();

Bivariate(
	Y( :Y4 ),
	X( :X ),
	Fit Spline( 0.1, Standardized, {Line Color( {212, 73, 88} )} ),
	Fit Spline( 10000, {Line Color( {61, 174, 70} )} ),
	Column Switcher( :Y4, {:Y1, :Y2, :Y3, :Y4} ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Frame Size( 444, 359 ), Marker Size( 6 ),
			Marker Drawing Mode( "Normal" ), Transparency( 0.5 ),
			Row Legend(
				Y2,
				Color( 1 ),
				Color Theme( "Blue to Gray to Red" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 1 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

It allows one to interactively make changes to the graph, and then when a new column is selected all of the changes are applied to the new column.

If you still want to do this not using the Column Switcher, what you need to do, is in your Radio Box, when a new selection is made, you extract the Script for the Bivariate, and then parse the script, replacing the the old column name, with the new column name, delete the old Bivariate report, and then run the newly modified script.

Jim
itzikd
Level II

Re: JSL replaceing a frame box based on check box

this works, is there a way to create row Legend selector so I can switch between legends,
lets say I have 2 more rows like this:

itzikd_0-1622988415493.png

then in the graph in addition the the column selector I will have on the right side a legend selector

itzikd_1-1622988616489.png

 

I tried using a script from another post, but each time I switch the row legend, it gets duplicated like this:

itzikd_2-1622988697411.png

 

I tried going over the tree structure and deleting but it doesn't work..

txnelson
Super User

Re: JSL replaceing a frame box based on check box

I believe that you can get what you want by using a Local Data Filter and setting it up into one of it's several options

cho.PNG

names default to here(1);
dt = Current Data Table();

Bivariate(
	Y( :Y4 ),
	X( :X ),
	Fit Spline( 0.1, Standardized, {Line Color( {212, 73, 88} )} ),
	Fit Spline( 10000, {Line Color( {61, 174, 70} )} ),
	Local Data Filter(
		Auto clear( 1 ),
		Add Filter( columns( :rowLeg1, :rowLeg2 ), Where( :rowLeg1 == "A" ) )
	),
	Column Switcher( :Y4, {:Y1, :Y2, :Y3, :Y4} ),
	SendToReport(
		Dispatch(
			{},
			"Bivar Plot",
			FrameBox,
			{Frame Size( 444, 359 ), Marker Size( 6 ),
			Marker Drawing Mode( "Normal" ), Transparency( 0.5 ),
			Row Legend(
				Y2,
				Color( 1 ),
				Color Theme( "Blue to Gray to Red" ),
				Marker( 0 ),
				Marker Theme( "" ),
				Continuous Scale( 1 ),
				Reverse Scale( 0 ),
				Excluded Rows( 0 )
			)}
		)
	)
);

Take a look at the documentation on the Local Data Filter, to see how to change it to make it handle your specific need

Jim
itzikd
Level II

Re: JSL replaceing a frame box based on check box

this works great, looked at the documentation but didn't find how to do something. not sure its possible

In the data filter option you can unselect numeric (picture below), how can I do this in JSL?

itzikd_0-1623160409054.png

I tried following this post

https://community.jmp.com/t5/Discussions/Data-Filter-only-by-columns-that-are-of-type-character/td-p...

But I get this:

itzikd_1-1623160492918.png

but what I actually want is just a list filtered with only characters or if I can filter by words that include only words that start with "PC_" for example

itzikd_2-1623160559936.png

 

 

 

https://community.jmp.com/t5/Discussions/Data-Filter-only-by-columns-that-are-of-type-character/td-p...

 

txnelson
Super User

Re: JSL replaceing a frame box based on check box

I do not see a way to remove the numeric columns via JSL.

Taking a second look, I have come up with a way to only display the Character columns.c1.JPG

Names Default To Here( 1 );
dt = Open( "$sample_data/big class.jmp" );
dis = Distribution( Continuous Distribution( Column( :height ) ), Local Data Filter );

mylist = (Report( dis ) << top parent)["Local Data Filter"][ListBoxBox( 1 )] << get items;
For( i = N Items( myList ), i >= 1, i--,
	If( Column( dt, myList[i] ) << get data type != "Character",
		(Report( dis ) << top parent)["Local Data Filter"][ListBoxBox( 1 )] << remove item( i )
	)
);
Jim