cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
burakbagdatli
Level III

Update Graphics Script with Local Data Filter

Is there a way to make the graphics script obey the local data filter? I'm trying to get the convex hull of a select number of points within the data table. However, the graph script calculates the convex hull of all the points in the table ignoring the local data filter.

 

The script I'm using for the convex hull is this:

tri = Triangulation( X( :MXC, :MZC ) );
Path( tri << Get Hull Path );

Is there a way to send an update or recalculate kind of a command to this script as the user interfaces with the local data filter?

 

Convex hull with all the pointsConvex hull with all the pointsConvex hull remains but the points get filtered. I want to shrink the convex hull.Convex hull remains but the points get filtered. I want to shrink the convex hull.

 

What we see of the real world is not the unvarnished real world but a model of the real world, constructed so it is useful for dealing with the real world. —Richard Dawkins
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Update Graphics Script with Local Data Filter

Check the Scripting Index example for the Box<<MakeRowStateHandler message.  This allows you to hook up a JSL callback when the filter row states change.  Unfortunately, the Triangulation object will use the global row states for the computation.  I think you would have to get the subset of values and pass in arrays of coordinates instead of column names for the X's.

 

Or....

 

In JMP 15 Graph Builder the convex hull is directly available as part of the Contour element, when used with a color role.  In this case the contour is based on a triangulation, and you can turn off the contours and show only the boundary.  This script in JMP 15 will demonstrate the feature:

 

Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Color( :height ) ),
	Elements(
		Contour( X, Y, Legend( 4 ), Fill( 0 ) ),
		Points( X, Y, Color( 0 ), Legend( 5 ) )
	),
	Local Data Filter(
		Add Filter(
			columns( :age ),
			Where( :age == 13 ),
			Display( :age, Height( 102 ) )
		)
	)
);

One big advantage of the built-in version (if using JMP 15 of course...) is that all of the Graph Builder grouping computations are already taken care of.  So, if you use another column in the overlay role, you will get a convex hull for each group:

 

Graph Builder.png

 

View solution in original post

2 REPLIES 2

Re: Update Graphics Script with Local Data Filter

Check the Scripting Index example for the Box<<MakeRowStateHandler message.  This allows you to hook up a JSL callback when the filter row states change.  Unfortunately, the Triangulation object will use the global row states for the computation.  I think you would have to get the subset of values and pass in arrays of coordinates instead of column names for the X's.

 

Or....

 

In JMP 15 Graph Builder the convex hull is directly available as part of the Contour element, when used with a color role.  In this case the contour is based on a triangulation, and you can turn off the contours and show only the boundary.  This script in JMP 15 will demonstrate the feature:

 

Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
	Size( 534, 456 ),
	Show Control Panel( 0 ),
	Variables( X( :height ), Y( :weight ), Color( :height ) ),
	Elements(
		Contour( X, Y, Legend( 4 ), Fill( 0 ) ),
		Points( X, Y, Color( 0 ), Legend( 5 ) )
	),
	Local Data Filter(
		Add Filter(
			columns( :age ),
			Where( :age == 13 ),
			Display( :age, Height( 102 ) )
		)
	)
);

One big advantage of the built-in version (if using JMP 15 of course...) is that all of the Graph Builder grouping computations are already taken care of.  So, if you use another column in the overlay role, you will get a convex hull for each group:

 

Graph Builder.png

 

burakbagdatli
Level III

Re: Update Graphics Script with Local Data Filter

Incredible. I cannot wait for my organization to upgrade!

In the meantime, I'll try to put something together for v14 as you described.

What we see of the real world is not the unvarnished real world but a model of the real world, constructed so it is useful for dealing with the real world. —Richard Dawkins