Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
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
Highlighted

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
Highlighted

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

Highlighted
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
Article Labels

    There are no labels assigned to this post.