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
vince_faller
Super User (Alumni)

Have a y function change with a local data filter.

I'm trying to draw on a graph some curve.  But that curve is different for some set of variables.  I'm wondering if anyone has a good way to make yfunction() change based off what's selected in a local data filter.  For instance, if I change age from 12 to 13, below, I want a cosine wave instead of sin wave or something like that.  

 

Note: this is for JMP live, so I don't think filter change handlers work there.  I was originally just plotting them all with a by variable drawing on each one individually, but that just doesn't work on JMP live either and I can't figure out why.  

 

Names default to here( 1 );
dt = open("$SAMPLE_DATA\Big Class.jmp");
dt << Graph Builder(
	Variables( X( :height ), Y( :weight ) ),
	Elements( Points( X, Y, Legend( 43 ) ), Smoother( X, Y, Legend( 44 ) ) ),
	Local Data Filter(
		Add Filter(
			columns( :age ),
			Where( :age == 12 ),
			Display( :age, N Items( 6 ) )
		)
	),
	SendToReport(
		Dispatch(
			{},
			"height",
			ScaleBox,
			{Min( 47.4910973084886 ), Max( 78.4293207137927 ), Inc( 5 ),
			Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"weight",
			ScaleBox,
			{Min( 43.4685580652897 ), Max( 152.924994106993 ), Inc( 20 ),
			Minor Ticks( 1 )}
		),
		Dispatch(
			{},
			"Graph Builder",
			FrameBox,
			{Add Graphics Script(
				5,
				Description( "" ),
				Pen Color( "red" );
				Pen Size( 3 );
				Y Function(
					49.5348183760347 + 101.831529865667 / 2 * (1
					+Sine( (2 * Pi() * (x - 50)) / 16.6 )),
					x
				);
			)}
		)
	)
);

 

Vince Faller - Predictum
4 REPLIES 4

Re: Have a y function change with a local data filter.

This goal is easy if you don't care about journaling. You can simply employ a user function in the call to Y Function() and define it outside of the Graph Builder launch. Then use a state handler with the data filter to define a new function and send the frame box << Reshow.

 

If you need to journal, then you don't want to use any variables. In that case, I would add a graphics script that uses only literal values, and remove and add a new one based on filter.

 

Have fun!

vince_faller
Super User (Alumni)

Re: Have a y function change with a local data filter.

That wouldn't work for JMP live though would it?  From what I've seen, JMP live REALLY doesn't like scripting.  I'll try it either way.  

Vince Faller - Predictum
Craige_Hales
Super User

Re: Have a y function change with a local data filter.

I'm pretty sure JMP Live does not run arbitrary (maybe any) user scripts on the server.

Quit();

or

while( 1, 0 );

or

x = j( 4e9, 1, 0);

or

wait( 1e6 );

any of which could appear in a graphic script, disrupting the server behavior.

 

The use case for JMP Live revolves around letting your audience slice-and-dice the data using JMP's builtin tools via a GUI you create.

 

  • linking graphs for selection behavior across graphs
  • using a data filter to subset data
  • drill down for subsetting (maybe...it has been a long time since I looked at JMP Live ... actually the public version.)

 

Craige

Re: Have a y function change with a local data filter.

Craige is correct. At this time we don't support running arbitrary JSL scripts.

 

One way to tell if JMP Live will support what you create is to publish to JMP Live, then download the script that was captured from the details panel in JMP Live. If you run this script with the table(s) needed to run it(you can download those too!), what you see in JMP is what you would see if the report is updated or regenerated on JMP Live. 

 

Doing this would also help if you are collaborating with another JMP user who will be downloading your content to explore it further in JMP. 

 

I hope this helps, 

~John