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

How to pass parameters to the specified JSL in the graph fetch?

Examples in the index of software

dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
gb = dt << Graph Builder( Show Control Panel( 0 ), Variables( X( :age ), Y( :weight ) ), Elements( Bar( X, Y, Legend( 7 ) ) ));
frame = (gb << report)[FrameBox( 1 )];
frame << Set Graphlet( Picture(  loader = Include( "$BUILTIN_SCRIPTS/hllib.jsl" );  hlp = loader:lazyLoad( "hllPresets" );  hlp:launchPie(); ), Title( "Pie Preset" ), Reapply( 1 ));

How does it pass parameters to hllib.jsl?
Which variable name is it in hllib.jsl?

Thanks!

2024-02-22_13-52-28.png

 

11 REPLIES 11
jthi
Super User

Re: How to pass parameters to the specified JSL in the graph fetch?

What are you trying to pass?

-Jarmo
lala
Level VII

Re: How to pass parameters to the specified JSL in the graph fetch?

You run the above JSL,
The cursor hovers over the graph, gets the "age" parameter, and gets the pie chart via hllib.jsl.
No pie chart appears without hllib.jsl.
So I think it's passing the age parameter.


I want to know how this example works.

 

Thanks!

jthi
Super User

Re: How to pass parameters to the specified JSL in the graph fetch?

Age is found from x-axis so it will be shown in the hoverlabel

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Show Control Panel(0),
	Variables(X(:age), Y(:weight)),
	Elements(Bar(X, Y, Legend(7))),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Set Graphlet(
				Picture(
					Graph Builder(
						Size(502, 435),
						Show Control Panel(0),
						Variables(X(:name), Y(:weight)),
						Elements(Pie(X, Y, Legend(10)))
					)
				)
			)}
		)
	)
);

jthi_0-1708584444823.png

 

-Jarmo
lala
Level VII

Re: How to pass parameters to the specified JSL in the graph fetch?

Thank jthi!

 

That's probably not the answer I was looking for.
I found this example because I wanted to keep it  the form of

Include( "$BUILTIN_SCRIPTS/hllib.jsl" );

Because I also need to use Include("D:\test.jsl") in my own example application;The form of.
So I need to know how hllib.jsl gets parameter passing in the above example.
Thank you very much!

jthi
Super User

Re: How to pass parameters to the specified JSL in the graph fetch?

I have commented few times to you already, read the documentation regarding hover labels from JMP Help and especially

Work with the Hover Label Execution Context (jmp.com)

One way of seeing all the variables (to my knowledge) which you can access in hover labels local context, is to use Namespace("local") << get contents() 

 

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Show Control Panel(0),
	Variables(X(:age), Y(:weight)),
	Elements(Bar(X, Y, Legend(7))),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Set Graphlet(
				Picture(
					Show(Namespace("local") << Get Contents());
					Graph Builder(
						Size(502, 435),
						Show Control Panel(0),
						Variables(X(:name), Y(:weight)),
						Elements(Pie(X, Y, Legend(10)))
					)
				)
			)}
		)
	)
);

 

Namespace("local") << Get Contents() = 
{
	{"_filters", {:age}}, 
	{"_mode", "Picture"}, 
	{"_where", ":age == 17"}, 
	{"_age", 17}, 
	{"_name", "KIRK, LAWRENCE, LINDA"}, 
	{"_groupings", {:age}},
	{"_firstRow", 38}, 
	{"_Mean(weight)", 140.666666666667}, 
	{"_underlyingRows", 3}, 
	{"_measurements", {:weight}}, 
	{"_displaySegName", "BarSeg"}, 
	{"_dataTable", Data Table("Big Class")},
	{"_summaryStatistic", "Mean"}, 
	{"_drillDepth", 1}, 
	{"_xaxis", 0}, 
	{"_yaxis", 0}, 
	{"_customData", [=> ]}, 
	{"_localDataFilter", "Local Data Filter(Close Outline(1), Add Filter(columns(:age), Where(:age == 17)))"},
	{"_whereExpr", :age == 17}
};
-Jarmo
lala
Level VII

Re: How to pass parameters to the specified JSL in the graph fetch?

Yes, thank you for your patient help.

My understanding of scripts is limited.Never understood.

I am so that I can understand,

But it doesn't seem to work.

 

2024-02-22_15-47-45.png

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Bar( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Set Textlet(
				Setup(
					local:encodedWhere = XML Encode( local:_where );
					/* Show() provides additional information about the
					HLEC variables in the log */
					Show( Namespace( "local" ) << Get Contents() );
				),
				Markup(
					"
<b>Groupings</b>: {local:_groupings}
<b>Measurements</b>: {local:_measurements}
<b>Summary statistic</b>: {local:_summaryStatistic}
<b>Filter columns</b>: {local:_filters}
<b>Where clause</b>: {local:encodedWhere}
<b>Graph type</b>: {local:_displaySegName}
<b>Data table</b> {local:_dataTable}
<b>Drill depth</b>: {local:_drillDepth}
<b>First Row</b>: {local:_firstRow}
<b>Underlying Rows</b>: {local:_underlyingRows}
"
				)
			)}
		)
	)
);
a = {local:encodedWhere};
b = {local:encodedWhere}[1];
jthi
Super User

Re: How to pass parameters to the specified JSL in the graph fetch?

They are in local scope, so they don't exist outside hover label -> use them inside the hover label call.

-Jarmo
lala
Level VII

Re: How to pass parameters to the specified JSL in the graph fetch?

yes

I try

Set Clipboard( {local:encodedWhere} );

in JSL 18 row

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Graph Builder(
	Size( 528, 450 ),
	Show Control Panel( 0 ),
	Variables( X( :sex ), Y( :height ) ),
	Elements( Bar( X, Y, Legend( 3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Set Textlet(
				Setup(
					local:encodedWhere = XML Encode( local:_where );
					/* Show() provides additional information about the
					HLEC variables in the log */
					Show( Namespace( "local" ) << Get Contents() );
					Set Clipboard( {local:encodedWhere} );
				),
				Markup(
					"
<b>Groupings</b>: {local:_groupings}
<b>Measurements</b>: {local:_measurements}
<b>Summary statistic</b>: {local:_summaryStatistic}
<b>Filter columns</b>: {local:_filters}
<b>Where clause</b>: {local:encodedWhere}
<b>Graph type</b>: {local:_displaySegName}
<b>Data table</b> {local:_dataTable}
<b>Drill depth</b>: {local:_drillDepth}
<b>First Row</b>: {local:_firstRow}
<b>Underlying Rows</b>: {local:_underlyingRows}
"
				);				
			)}
		)
	)
);

 

But it only get

{local:encodedWhere}
jthi
Super User

Re: How to pass parameters to the specified JSL in the graph fetch?

I don't test anything in JMP18 as it isn't ready product so no idea if it behaves in different way (and if it does I will only comment that to JMP developers). JMP lists aren't evaluated, you will have to evaluated it or not use the list (there should be no need for adding the list in your case).

 

Names Default To Here(1); 

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

gb = dt << Graph Builder(
	Show Control Panel(0),
	Variables(X(:age), Y(:weight)),
	Elements(Bar(X, Y, Legend(7))),
	SendToReport(
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Set Graphlet(
				Picture(
					Set Clipboard(Char(local:_where));
					//Set Clipboard(local:encodedWhere);
					Graph Builder(
						Size(502, 435),
						Show Control Panel(0),
						Variables(X(:name), Y(:weight)),
						Elements(Pie(X, Y, Legend(10)))
					)
				)
			)}
		)
	)
);
-Jarmo