Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
avner8943
Level III

Add ref line and column switcher

Hi all,

 

I have two questions:

 

1) when I switch column with column switcher, I can't add ref line anymore. for example

 

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
obj = dt << Bivariate( Y( :height ), X( :weight ) );

ColumnSwitcherObject = obj << Column Switcher( :height, {:name, :age, :sex, :height} );


gbReport = obj << report;

axisbox = gbReport[axis box( 1)];

now when I run the next line

 

 

axisbox << Add Ref Line(60, "Dotted", yellow, "TR", 2 );

It's working.image.png

 

 

 

But if run this two lines 

ColumnSwitcherObject << set current("age"); axisbox << Add Ref Line(14, "Dotted", yellow, "TR", 2 );

It giving me this error

 

deleted object reference: axisbox << Add Ref Line(14, "Dotted", yellow, "TR", 2) in access or evaluation of 'Send' , axisbox <<  /*###*/Add Ref Line( 14, "Dotted", yellow, "TR", 2 ) /*###*/

In the following script, error marked by /*###*/
axisbox <<  /*###*/Add Ref Line( 14, "Dotted", yellow, "TR", 2 ) /*###*/

 

 

2) Is there a way to execute a script when switching columns in column switcher? Something like "makerowstatehandler" when we use local data filter?

 

Thanks.

 

3 REPLIES 3
Highlighted

Re: Add ref line and column switcher

For #1, you need to re-run the line that sets the AxisBox variable first. This is because the Column Switcher in JMP re-generates the report when the column changes, so the old references to the report and axis box are no longer valid.

// Always needs to happen in this order
gbReport = obj << report;
axisbox = gbReport[axis box( 1 )];
axisbox << Add Ref Line(14, "Dotted", yellow, "TR", 2 );

For #2, I do not believe there is an equivalent handler for Column Switcher like there is for the Data Filter. This might be a good idea for the JMP Wish List.

Justin
Highlighted
avner8943
Level III

Re: Add ref line and column switcher

Thanks, 

 

But it's showing me this error 

 

axisbox << Add Ref Line( 14, "Dotted", yellow, "TR", 2 );

and not displaying the line

Highlighted
txnelson
Super User

Re: Add ref line and column switcher

The column switcher has the habit to drop its reference when a column is swapped out.  By either embedding the reference line into the code

Bivariate(
	Y( :height ),
	X( :weight ),
	SendToReport(
		Dispatch(
			{},
			"2",
			ScaleBox,
			{Add Ref Line( 62.9375, "Dashed", "Yellow", "TR", 1 )}
		)
	)
);

or adding the code by using

<<add graphics script

I believe you can get around the issue

or

Jim
Article Labels

    There are no labels assigned to this post.