cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
AdamChoen
Level IV

window tabs with active lagend

Hello,

 

my script creates a window with a new tab for every bivariate trend chart, my issue is that the legend is inactive.

my end goal is to be able to highlight legend groups in interactive HTML.

 

I tried to add a local data filter - and it did not work for me.

I also tried adding the same lagend distribution chart.

 

I love to get more ideas or insights on what I'm doing wrong.

 

names default to here(1);
dt=open("$SAMPLE_DATA/big class.jmp");

NW = New Window( "new window", Text Box( "Creation Date: " || Substitute( Format( Today(), "ddMonyyyy h:m:s" ), "-", ":" ) ),  tb = tab Box() );

sex_list = Associative Array( :sex ) << Get Keys;

For( i = 1, i <= N items( sex_list ), i++,
	dt << Clear Row States;
	dt << Select Where( :sex == sex_list[i] ) << Invert Row Selection <<  Hide and Exclude;
	dt << clear select;
		
		// create trend chart with limits
	
		Biv = dt << Bivariate(
			Y( :height ),
			X( :weight ),
/*			By( :Var ),
			Local Data Filter(
			Mode( Include( 0 ) ),
			Add Filter( columns( :CHAMBER ), Display( :CHAMBER) )
			),*/
			SendToReport(
				Dispatch(
					{},
					"Bivar Plot",
					FrameBox,
					{Frame Size( 1000, 300 ), Row Legend(
						name,
						Color( 1 ),
						Color Theme( "JMP Default"(1) ),
						Marker( 1 ),
						Marker Theme( "Standard" )
					)}
				)
			)
		);
		
		Dis = dt << Distribution( Nominal Distribution( Column( :name ), Frequencies( 0 ) ) );
	

	tb  << Append( Char(Sex_list[i]) , H list box(Report( Dis ), Report( Biv )));
	Biv << Close window;
	Dis << Close window;

);


NW << save Interactive HTML( SaveDirectory || "new window.htm" ) << close window;
dt << close window;


Thanks, Adam
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: window tabs with active lagend

You append only report to the new window and that isn't interactive (there are two "layers" in JMP platforms). You can get some interactivity by appending the platforms BUT legend won't be interactive

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

NW = New Window("new window",
	Text Box("Creation Date: " || Substitute(Format(Today(), "ddMonyyyy h:m:s"), "-", ":")),
	tb = Tab Box()
);

sex_list = Associative Array(:sex) << Get Keys;

For(i = 1, i <= N Items(sex_list), i++,
	dt << Clear Row States;
	dt << Select Where(:sex == sex_list[i]) << Invert Row Selection << Hide and Exclude;
	dt << clear select;
	
	biv_expr = Expr(dt << Bivariate(
		Y(:height),
		X(:weight), 
		SendToReport(
			Dispatch({}, "Bivar Plot", FrameBox,
				{Frame Size(1000, 300), Row Legend(
					name,
					Color(1),
					Color Theme("JMP Default"(1)),
					Marker(1),
					Marker Theme("Standard")
				)}
			)
		)
	));

	dist_expr = Expr(dt << Distribution(Automatic Recalc(1), Nominal Distribution(Column(:name), Frequencies(0))));

	tb << Append(
		Char(Sex_list[i]), 
		H List Box(
			dist_expr,
			biv_expr
		)
	);
);


nw << Save Interactive HTML("$TEMP/deleteme.html");
Close(dt, no save);

Web("$TEMP/deleteme.html");

Write();

If you have JMP18 and use Graph Builder to create your scatterplot then I think you can get interactive legend with some small extra work (use marker row states and then use the same column as overlay/color in graph builder)

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: window tabs with active lagend

You append only report to the new window and that isn't interactive (there are two "layers" in JMP platforms). You can get some interactivity by appending the platforms BUT legend won't be interactive

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

NW = New Window("new window",
	Text Box("Creation Date: " || Substitute(Format(Today(), "ddMonyyyy h:m:s"), "-", ":")),
	tb = Tab Box()
);

sex_list = Associative Array(:sex) << Get Keys;

For(i = 1, i <= N Items(sex_list), i++,
	dt << Clear Row States;
	dt << Select Where(:sex == sex_list[i]) << Invert Row Selection << Hide and Exclude;
	dt << clear select;
	
	biv_expr = Expr(dt << Bivariate(
		Y(:height),
		X(:weight), 
		SendToReport(
			Dispatch({}, "Bivar Plot", FrameBox,
				{Frame Size(1000, 300), Row Legend(
					name,
					Color(1),
					Color Theme("JMP Default"(1)),
					Marker(1),
					Marker Theme("Standard")
				)}
			)
		)
	));

	dist_expr = Expr(dt << Distribution(Automatic Recalc(1), Nominal Distribution(Column(:name), Frequencies(0))));

	tb << Append(
		Char(Sex_list[i]), 
		H List Box(
			dist_expr,
			biv_expr
		)
	);
);


nw << Save Interactive HTML("$TEMP/deleteme.html");
Close(dt, no save);

Web("$TEMP/deleteme.html");

Write();

If you have JMP18 and use Graph Builder to create your scatterplot then I think you can get interactive legend with some small extra work (use marker row states and then use the same column as overlay/color in graph builder)

-Jarmo