Choose Language Hide Translation Bar
Highlighted
sac
sac
Community Member

Interactive HTML with filter

I am able to create an interactive HTML using "save Interactive HTML". However, when I add a filter, it does not create the filter in the HTML, just gives me the plot. Is there something I am missing?

My sample code:

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
a = Variability Chart(
	Y( :height ),
	X( :age ),
	Analysis Type( "Choose best analysis (EMS REML Bayesian)" ),
	Connect Cell Means( 1 ),
	Std Dev Chart( 0 ),
	Points Jittered( 1 ),
	AIAG Labels( 0 ),
	SendToReport(
		Dispatch( {}, "Variability Gauge", OutlineBox, {Set Title( "VariabilityChart" )} ),
		Dispatch( {}, "Variability Chart for height", OutlineBox, {Set Title( "" )} ),
		Dispatch( {"Variability Chart for height"}, "Variability Chart", FrameBox, {Frame Size( 845, 274 )} )
	),
	Local Data Filter(
		Add Filter( columns( :Name( "SEX" ) ), Display( :Name( "SEX" ), Size( 278, 165 ), List Display ) )
	)
);
a << Save Interactive HTML( path || "Filter.html" );

This is what I want

sac_0-1581360420991.png

 

This is what I get

sac_1-1581360458218.png

 

 

0 Kudos
5 REPLIES 5
Highlighted
Byron_JMP
Staff

Re: Interactive HTML with filter

The problem is that putting a filter into the HTML, and making it work would require the html to recalculate the data for the graph. If you happened to have JMP Live, then you could publish this figure to the JMP Live server, and then when you change the filter, an instance of JMP on the Live server would do this for you.  

 

kind of like this:

Example HTML figure with a filter 

 

Another approach is to make tabs with each level of the filter 

kind of like this: 

figure with tab boxes 

       note: the tab boxes are over the run chart at the bottom of the "dashboard".

 

 

 

 

JMP Systems Engineer, Pharm and BioPharm Sciences
Highlighted
txnelson
Super User

Re: Interactive HTML with filter

If I run this script

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

		vc = dt << Variability Chart(
			Y( :NPN1 ),
			X( :lot_id, :SITE ),
			Local Data Filter(
				Add Filter( columns( :wafer ), Display( :wafer, Size( 161, 255 ), Height( 255 ) ) )
			)
		)
	)
);

and then interactively go to

     File=>Save As

and save the file as an Interactive HTML With Data, or if one goes to

     File=> Export=> HTML with Data

I get the following HTML

withdata.PNG

But I can not find a JSL function that can do the same.

Jim

Re: Interactive HTML with filter

Thanks to @gzmorgan0 for supplying an answer here:

https://community.jmp.com/t5/Discussions/Missing-Local-Data-Filter-in-quot-Save-Interactive-HTML-quo...

Just replace:

a << Save Interactive HTML( path || "Filter.html" );

with 

tr = a << Top Report;
tr << Save Interactive HTML( path || "Filter.html" ); 

Note that when saved this way rather than published to JMP Live or JMP Public, the Local Data Filter will act as though you turned off the Include option.

John_Powell_JMP_0-1581531438630.png

So you might as well turn it off in the script by adding Mode( include( 0 )) to the Local Data Filter definition as shown here: 

Local Data Filter(
		Width( 278 ),
		Mode( Include( 0 ) ),
		Add Filter(
			columns( :sex ),
			Where( :sex == "M" ),
			Display( :sex, Size( 272, 168 ), Height( 168 ), "List Display" )
		)
	),

I hope that helps.

~John

 

 

Highlighted

Re: Interactive HTML with filter

Just to underline what John said: This way of using local data filter will only have the show functionality, it does not recalculate the resulting graphs or statistics, like lines or profiler or mean .... If that is what you need JMP live is the right tool to go for when publishing to the web.
Thanks John for this example!
Highlighted

Re: Interactive HTML with filter

Those are great examples, Byron!