cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Discussions

Solve problems, and share tips and tricks with other JMP users.
%3CLINGO-SUB%20id%3D%22lingo-sub-366077%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E4%BD%BF%E7%94%A8%20JSL%20%E5%9C%A8%E5%9B%BE%E5%BD%A2%E6%9E%84%E5%BB%BA%E5%99%A8%E4%B8%AD%E5%88%A0%E9%99%A4%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%8C%85%E8%A3%85%E5%8F%98%E9%87%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-366077%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E5%BD%93%E6%88%91%E9%80%9A%E8%BF%87%E7%AA%97%E5%8F%A3%E4%B8%AD%E7%9A%84%E6%9C%8D%E8%A3%85%E5%9B%BE%E5%BD%A2%E8%84%9A%E6%9C%AC%E5%87%BD%E6%95%B0%E5%9C%A8%E5%9B%BE%E5%BD%A2%E7%94%9F%E6%88%90%E5%99%A8%E4%B8%AD%E6%89%8B%E5%8A%A8%E6%B7%BB%E5%8A%A0%E4%B8%80%E6%9D%A1%E7%BA%BF%EF%BC%8C%E7%84%B6%E5%90%8E%E7%94%A8%E6%A0%87%E7%A7%B0%E5%8F%98%E9%87%8F%E5%B0%86%E5%85%B6%E5%8C%85%E8%A3%85%E6%88%96%E5%88%86%E7%BB%84%E6%97%B6%EF%BC%8C%E5%A0%86%E5%8F%A0%E7%9A%84%E7%AA%97%E5%8F%A3%E5%B0%86%E5%A4%8D%E5%88%B6%E7%9B%B8%E5%90%8C%E7%9A%84%E6%9C%8D%E8%A3%85%E7%BA%BF%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%E5%9C%A8%E5%9B%BE%E5%BD%A2%E7%AA%97%E5%8F%A3%E4%B8%AD%E5%8F%B3%E9%94%AE%E5%8D%95%E5%87%BB%20--%26gt%3B%20%E8%87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3C%2FP%3E%3CP%3E%E6%88%91%E6%83%B3%E5%9C%A8%20JSL%20%E4%B8%AD%E6%89%8B%E5%8A%A8%E6%89%A7%E8%A1%8C%E7%9B%B8%E5%90%8C%E7%9A%84%E6%AD%A5%E9%AA%A4%EF%BC%9A%3C%2FP%3E%3CP%3E-%20%E5%88%9B%E5%BB%BA%E5%9B%BE%E8%A1%A8%3C%2FP%3E%3CP%3E-%20%E8%AE%BE%E7%BD%AE%E6%9C%8D%E8%A3%85%E7%BA%BF%3C%2FP%3E%3CP%3E-%20%E6%B7%BB%E5%8A%A0%E6%8D%A2%E8%A1%8C%E5%88%97%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-366077%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CLINGO-LABEL%3E%E5%9B%BE%E5%BD%A2%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3E%E8%84%9A%E6%9C%AC%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-368514%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E4%BD%BF%E7%94%A8%20JSL%20%E5%9C%A8%E5%9B%BE%E5%BD%A2%E6%9E%84%E5%BB%BA%E5%99%A8%E4%B8%AD%E5%88%A0%E9%99%A4%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%8C%85%E8%A3%85%E5%8F%98%E9%87%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-368514%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E6%B7%BB%E5%8A%A0%E5%92%8C%E5%88%A0%E9%99%A4%E5%8C%85%E8%A3%85%E5%8F%98%E9%87%8F%E7%9A%84%E4%BB%A3%E7%A0%81%E7%89%87%E6%AE%B5%E3%80%82%20%E8%BF%99%E6%9D%A5%E8%87%AA%E5%9C%A8%E7%BA%BF%E5%8F%91%E7%8E%B0%E5%B3%B0%E4%BC%9A%202021%20unsession%20JSL%20%E8%84%9A%E6%9C%AC%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%2FBig%20Class.jmp%22%20)%3B%0A%0A%2F%2Fmake%20initial%20graph%0Agb%20%3D%20Graph%20Builder(%0A%20Variables(%20X(%20%3Aheight%20)%2C%20Y(%20%3Aweight%20)%20)%2C%0A%20Elements(%20Points(%20X%2C%20Y%20)%2C%20Smoother(%20X%2C%20Y%20)%20)%0A)%3B%0A%0A%2F%2Fget%20a%20reference%20to%20the%20grab%20builder%20box%0Agbb%20%3D%20Report(%20gb%20)%5BGraph%20Builder%20Box(%201%20)%5D%3B%0A%0AWait(%201%20)%3B%0A%0A%2F%2Fadd%20a%20wrap%20variable%20to%20demonstrate%20adding%0Agbb%20%26lt%3B%26lt%3B%20Add%20Variable(%20%7B%3Aage%2C%20Role(%20%22Wrap%22%20)%7D%20)%3B%0A%0AWait(%201%20)%3B%0A%0A%2F%2Fremove%20wrap%20variable%0Agbb%20%26lt%3B%26lt%3B%20Remove%20Variable(%20%20%7B%3Aage%2C%20Role(%20%22Wrap%22%20)%7D)%3B%0A%0AWait(%201%20)%3B%0A%0A%2F%2Fadd%20graphics%20script%0Agbb%5Bframe%20box(%201%20)%5D%20%26lt%3B%26lt%3B%20Add%20Graphics%20Script(%0A%202%2C%0A%20Description(%20%22%22%20)%2C%0A%20If(%20Is%20Empty(%20g_x4%20)%2C%0A%20%20g_x4%20%3D%20%5B52.92%2C%2068.48%2C%2070.56%5D%3B%0A%20%20g_y4%20%3D%20%5B119.69%2C%20139.30%2C%20124.01%5D%3B%0A%20)%3B%0A%20Drag%20Line(%20g_x4%2C%20g_y4%20)%3B%0A)%3B%0A%0A%2F%2Fadd%20wrap%20variable%20%20%20%0Agbb%20%26lt%3B%26lt%3B%20Add%20Variable(%20%7B%3Aage%2C%20Role(%20%22Wrap%22%20)%7D%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%E8%84%9A%E6%9C%AC%E7%94%B1%3CA%20href%3D%22https%3A%2F%2Fcommunity.jmp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F2026%22%20target%3D%22_blank%22%3E%40%E6%9C%B1%E5%88%A9%E5%AE%89%3C%2FA%3E%E5%A4%9A%E8%B0%A2%E3%80%82%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-366101%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%E5%9B%9E%E5%A4%8D%EF%BC%9A%E4%BD%BF%E7%94%A8%20JSL%20%E5%9C%A8%E5%9B%BE%E5%BD%A2%E6%9E%84%E5%BB%BA%E5%99%A8%E4%B8%AD%E5%88%A0%E9%99%A4%E5%92%8C%E6%B7%BB%E5%8A%A0%E5%8C%85%E8%A3%85%E5%8F%98%E9%87%8F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-366101%22%20slang%3D%22en-US%22%20mode%3D%22NONE%22%3E%3CP%3E%E4%BB%A5%E4%B8%8B%E7%A4%BA%E4%BE%8B%E4%BD%BF%E7%94%A8%20%26lt%3B%3CADD%20graphics%3D%22%22%20script%3D%22%22%3E%0A%3CPRE%3E%3CCODE%20class%3D%22%20language-jsl%22%3ENames%20Default%20To%20Here(%201%20)%3B%0A%0Adt%20%3D%20Open(%20%22%24SAMPLE_DATA%5CBig%20Class.jmp%22%20)%3B%0A%0Agb%20%3D%20dt%20%26lt%3B%26lt%3B%20Graph%20Builder(%0A%20Size(%20534%2C%20456%20)%2C%0A%20Show%20Control%20Panel(%200%20)%2C%0A%20Variables(%20X(%20%3Aheight%20)%2C%20Y(%20%3Aweight%20)%20)%2C%0A%20Elements(%20Points(%20X%2C%20Y%2C%20Legend(%202%20)%20)%2C%20Smoother(%20X%2C%20Y%2C%20Legend(%204%20)%20)%20)%0A)%3B%0A%0AReport(%20gb%20)%5BFrameBox(%201%20)%5D%20%26lt%3B%26lt%3B%20Add%20Graphics%20Script(%0A%20If(%20Is%20Empty(%20g_x1%20)%2C%0A%20%20g_x1%20%3D%20%5B50.53%2C%2066.28%2C%2064.49%5D%3B%0A%20%20g_y1%20%3D%20%5B102.99%2C%2045.69%2C%20106.10%5D%3B%0A%20)%3B%0A%20Drag%20Line(%20g_x1%2C%20g_y1%20)%3B%0A)%3B%0A%0AReport(%20gb%20)%5BGraph%20Builder%20Box(%201%20)%5D%20%26lt%3B%26lt%3B%20Add%20Variable(%20%7B%3Aage%2C%20Role(%20%22Wrap%22%20)%7D%20)%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3C%2FADD%3E%3C%2FP%3E%3CP%3E%E6%88%91%E5%B8%8C%E6%9C%9B%E8%BF%99%E6%9C%89%E5%B8%AE%E5%8A%A9%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E
Choose Language Hide Translation Bar
Mauro_Gerber
Level IV

Remove and add wrap variables in graph builder with JSL

When I manually add a line in graph builder via the costume graph script function in the window and then wrap or group it with a nominal variable, the stacked windows will have the same costume line copied.

 

Right click in the graph windows --> Customize --> click on the “+” button (add the “Script” entry) and add the line script (for example with the Samples --> “Drag Line” option).

 

But if I then save the script to the data table, every windows has now an entry to add the costume graph and can become very long. I would need to program a complicated for loop to add the graph code to each window.

 

I want to make the same steps in JSL as by hand:

- create graph

- set costume line

- add the wrap column

 

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS
1 ACCEPTED SOLUTION

Accepted Solutions
Mauro_Gerber
Level IV

Re: Remove and add wrap variables in graph builder with JSL

Code snippet to add and remove a wrap variable. This came from the online discovery summit 2021 unsession JSL scripting.

 

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

//make initial graph
gb = Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);

//get a reference to the grab builder box
gbb = Report( gb )[Graph Builder Box( 1 )];

Wait( 1 );

//add a wrap variable to demonstrate adding
gbb << Add Variable( {:age, Role( "Wrap" )} );

Wait( 1 );

//remove wrap variable
gbb << Remove Variable(  {:age, Role( "Wrap" )});

Wait( 1 );

//add graphics script
gbb[frame box( 1 )] << Add Graphics Script(
	2,
	Description( "" ),
	If( Is Empty( g_x4 ),
		g_x4 = [52.92, 68.48, 70.56];
		g_y4 = [119.69, 139.30, 124.01];
	);
	Drag Line( g_x4, g_y4 );
);

//add wrap variable			
gbb << Add Variable( {:age, Role( "Wrap" )} );

Script by  @julian THX a lot.

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS

View solution in original post

2 REPLIES 2

Re: Remove and add wrap variables in graph builder with JSL

The following example uses the <<Add Graphics Script() message to add the Drag Line.  

Names Default To Here( 1 );

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

gb = dt << Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 4 ) ) )
);

Report( gb )[FrameBox( 1 )] << Add Graphics Script(
	If( Is Empty( g_x1 ),
		g_x1 = [50.53, 66.28, 64.49];
		g_y1 = [102.99, 45.69, 106.10];
	);
	Drag Line( g_x1, g_y1 );
);

Report( gb )[Graph Builder Box( 1 )] << Add Variable( {:age, Role( "Wrap" )} );

I hope that helps.

Wendy
Mauro_Gerber
Level IV

Re: Remove and add wrap variables in graph builder with JSL

Code snippet to add and remove a wrap variable. This came from the online discovery summit 2021 unsession JSL scripting.

 

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

//make initial graph
gb = Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y ), Smoother( X, Y ) )
);

//get a reference to the grab builder box
gbb = Report( gb )[Graph Builder Box( 1 )];

Wait( 1 );

//add a wrap variable to demonstrate adding
gbb << Add Variable( {:age, Role( "Wrap" )} );

Wait( 1 );

//remove wrap variable
gbb << Remove Variable(  {:age, Role( "Wrap" )});

Wait( 1 );

//add graphics script
gbb[frame box( 1 )] << Add Graphics Script(
	2,
	Description( "" ),
	If( Is Empty( g_x4 ),
		g_x4 = [52.92, 68.48, 70.56];
		g_y4 = [119.69, 139.30, 124.01];
	);
	Drag Line( g_x4, g_y4 );
);

//add wrap variable			
gbb << Add Variable( {:age, Role( "Wrap" )} );

Script by  @julian THX a lot.

 

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS

Recommended Articles