JSL replaceing a frame box based on check boxthis 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
| X | Y1 | Y2 | Y3 | Y4 |
| 160.5893 | 194 | 16.79012 | 0.498753 | 7.26817 |
| 160.2228 | 234 | 20.4878 | 0.738916 | 4.466501 |
| 159.5072 | 240 | 15.53398 | 0.488998 | 5.159705 |
| 160.06 | 268 | 11.27098 | 1.213592 | 4.600484 |
| 160.9668 | 230 | 17.35941 | 0.2457 | 5.867971 |
| 159.3969 | 222 | 19.08213 | 0.980392 | 8.845209 |
| 161.0078 | 223 | 21.19701 | 0.75 | 6.766917 |
| 159.6957 | 201 | 21.44638 | 0.251889 | 9.343434 |
| 159.539 | 237 | 18.90547 | 0.498753 | 9 |
| 160.9438 | 210 | 16.38142 | 0.492611 | 9.605911 |
| 160.2693 | 229 | 19.11765 | 0.247525 | 8.188586 |
| 160.6793 | 220 | 17.07317 | 1.231527 | 6.157635 |
| 161.8911 | 187 | 21.62162 | 0.49505 | 9.158416 |
| 162.628 | 201 | 20.82324 | 0.977995 | 10.51345 |
| 162.8909 | 192 | 20.4878 | 0.4914 | 6.896552 |
| 163.0162 | 212 | 18.79518 | 0.243309 | 7.073171 |
| 160.8283 | 206 | 17.03163 | 0.490196 | 8.557457 |
| 160.3191 | 208 | 22.87105 | 0.490196 | 7.823961 |
| 160.3265 | 222 | 19.95134 | 1.466993 | 9.046455 |
| 160.2706 | 227 | 18.42752 | 0.740741 | 6.947891 |
| 162.8886 | 186 | 18.85856 | 0.250627 | 7.537688 |
| 162.8631 | 189 | 23.61446 | 0.728155 | 7.055961 |
| 161.1953 | 241 | 16.34146 | 0.492611 | 8.108108 |
| 161.2756 | 239 | 12.31527 | 0.492611 | 5.707196 |
| 160.1107 | 247 | 16.66667 | 0.487805 | 5.121951 |
| 161.368 | 201 | 19.85294 | 0.738916 | 6.451613 |
| 161.2246 | 218 | 20.19704 | 0.49505 | 7.5 |
| 160.0145 | 215 | 23.11436 | 0.735294 | 8.148148 |
| 161.6576 | 149 | 18.15182 | 0.33557 | 10.10101 |
| 159.5943 | 248 | 14.56311 | 0.4914 | 6.356968 |
| 159.8647 | 182 | 22.80702 | 1.772152 | 10.07557 |
| 160.3423 | 227 | 13.13869 | 0.244499 | 7.090465 |
| 161.7888 | 241 | 16.42512 | 0.484262 | 5.326877 |
| 162.0188 | 219 | 20.43269 | 0.973236 | 7.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

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!
ScriptingRe: JSL replaceing a frame box based on check boxThe best way to handle what you are wanting, is to use a Column Switcher

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.
Re: JSL replaceing a frame box based on check boxthis 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:

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

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

I tried going over the tree structure and deleting but it doesn't work..
Re: JSL replaceing a frame box based on check boxI 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

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