cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
lala
Level VII

How can use variables instead of column names in graphing JSL?

For example, the following script, I want to use
aa="height";
bb="weight";
In JSL use aa, bb to code the relevant column names.

Thanks!

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
aa = "height";
bb = "weight";
p1 = dt << Graph Builder(
	Size( 765, 453 ),
	Show Control Panel( 0 ),
	Show Legend( 0 ),
	Legend Position( "Bottom" ),
	Variables( X( Transform Column( "Row", Formula( Row() ) ) ), Y( aa ), Y( bb, Position( 1 ), Side( "Right" ) ) ),
	Elements( Bar( X, Y( 1 ), Legend( 5 ) ), Bar( X, Y( 2 ), Legend( 6 ) ) ),
	SendToReport(
		Dispatch( {}, "Row", ScaleBox, {Min( 0 ), Max( 41.4241978609626 ), Inc( 10 ), Minor Ticks( 1 )} ),
		Dispatch( {}, aa, ScaleBox, {Min( 1 ), Max( 75.46 ), Inc( 10 ), Minor Ticks( 0 )} ),
		Dispatch( {}, bb, ScaleBox, {Min( 1 ), Max( 185.416 ), Inc( 50 ), Minor Ticks( 1 )} ),
		Dispatch(
			{},
			"400",
			ScaleBox,
			{Legend Model( 5, Properties( 0, {Fill Color( 36 )}, Item ID( aa, 1 ) ) ), Legend Model(
				6,
				Properties( 0, {Fill Color( 67 )}, Item ID( bb, 1 ) )
			)}
		),
		Dispatch( {}, "graph title", TextEditBox, {Set Text( "test" )} ),
		Dispatch( {}, "X title", TextEditBox, {Hide( 1 )} ),
		Dispatch( {}, "Y title", TextEditBox, {Set Text( aa || "999" )} ),
		Dispatch( {}, "Y r title", TextEditBox, {Set Text( bb || "999" )} )
	)
);
1 ACCEPTED SOLUTION

Accepted Solutions
David_Burnham
Super User (Alumni)

Re: How can use variables instead of column names in graphing JSL?

I have a blog post you might want to read:

 

http://www.pega-analytics.co.uk/blog/handling-column-references/

 

If you do a search in this forum you will find *lots* of information related to this topic.

-Dave

View solution in original post

2 REPLIES 2
David_Burnham
Super User (Alumni)

Re: How can use variables instead of column names in graphing JSL?

I have a blog post you might want to read:

 

http://www.pega-analytics.co.uk/blog/handling-column-references/

 

If you do a search in this forum you will find *lots* of information related to this topic.

-Dave
lala
Level VII

Re: How can use variables instead of column names in graphing JSL?

OK、Thanks Experts!

2023-03-28_17-26-46.png