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
shasheminassab
Level III

Local data filter and Custom Graph Script

I am using the approach suggested by @XanGregg in this post to make vector plots in Graph Builder. However, it seems the local data filter does not work on the arrows. It only filters the points but not the arrows. Do you have any suggestion on how to fix it?

6 REPLIES 6
Highlighted
txnelson
Super User

Re: Local data filter and Custom Graph Script

You will need to modify the Add Graphics Script code to recognize the new filter and then bypass drawing of the arrows for those rows.  There are functions such as X Origin() and Y Origin(), X Range() and Y Range() that can be checked to see if the graph has changed, and then you can display the filtered arrows.

Jim
Highlighted
shasheminassab
Level III

Re: Local data filter and Custom Graph Script

Thanks @txnelson. Could you please provide an example? I am not very well familiar with JSL. How can I make the Graphics Script to recognize the local data filter and bypass drawing of the arrows for those rows?

Highlighted
txnelson
Super User

Re: Local data filter and Custom Graph Script

Below is a piece of JSL that used a Data Filter, not a Local Data Filter to do what you want.  A Data filter Excludes and Hides the rows in the data table, which are easily picked up in the Add Graphics Script.  Using a Local Data Filter would require far more complexity.  See if this method may work for you

Names Default To Here( 1 );
dt = Current Data Table();
New Window( "Filtered Arrows",
	Lineup Box( N Col( 2 ),
		dt << Data Filter(
			Location( {780, 189} ),
			Width( 197 ),
			Mode( Show( 1 ), Include( 1 ) ),
			Add Filter( columns( :Speed ), Display( :Speed, Size( 185, 20 ), Height( 50 ) ) )
		),
		dt << Bivariate(
			Y( :Lat1 ),
			X( :Lon1 ),
			SendToReport(
				Dispatch(
					{},
					"Bivar Plot",
					FrameBox,
					{Frame Size( 501, 429 ), Add Graphics Script(
						2,
						Description( "Script" ),
						Pen Size( 2 );
						For Each Row(
							If( Excluded( Row State( Row() ) ) == 0,
								Arrow( {:lon1, :lat1}, {:lon2, :lat2} )
							)
						);
					), Grid Line Order( 3 ), Reference Line Order( 1 )}
				)
			)
		)
	)
);
Jim
Highlighted
shasheminassab
Level III

Re: Local data filter and Custom Graph Script

Many thanks!

Highlighted

Re: Local data filter and Custom Graph Script

If you want to make this work with the Local Data Filter, see the Scripting Index examples for:

 

box<<Get Row States

box<<Make Row State Handler

 

These are similar to methods that you can use on the DataTable object, but if the given box is subject to a filter, they will use the filter row states instead of the data table row states.

Highlighted
shasheminassab
Level III

Re: Local data filter and Custom Graph Script

Great! thanks @danschikore 

Article Labels