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
Neo
Neo
Level VI

How to use Filter Change Handler to work with Page option in Graph Builder?

Attached is an example data table. The script below tries to plot each parameter selected via the Local Data Filter in a new "Page" in Graph Builder. As it stands, the y-axis title is shown as "Median" every time a new "Parameter" is selected via the Local Data Filter.

I would like the Parameter name to be the y-axis title when new a parameter gets selected and plotted on a new "Page".

I tried using the filter change handler for this, but my script does not quite work. I think I need the index below to be updated each time a new parameter is selected or may be there is another way. Any direction will be useful. 

XPath( "//TextEditBox" ))[i]

here is my script

Names Default To Here (1);
Clear Log ();
gb = Graph Builder(
	Size( 531, 325 ),
	Show Control Panel( 0 ),
	Variables( X( :PartID ), Y( :Median ), Page( :Parameter ), Color( :TestStage ) ),
	Elements( Points( X, Y, Legend( 34 ) ) ),
	Local Data Filter(
		Conditional,
		Add Filter(
			columns( :TestStage, :Parameter ),
			Where( :TestStage == {"A", "B"} ),
			Where( :Parameter == {"BKDVoltage", "Capacitance"} )
		)
	),
	SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "myTitleGoesHere" )} ) )
);

ldf = Current Report()["Local Data Filter"] << get scriptable object;

changeTitle = Function( {this},
	print(this);
  	ldfText = Regex(ldf << get where clause(),"\(?\s*(:Parameter == .*?)\)","\1");
	if(ismissing(ldfText),ldfText = " Selected Test Parameter ");
	(Report( gb ) << XPath( "//TextEditBox" ))[6] << Set Text(ldfText);
);

fsh = ldf << Make Filter Change Handler(changeTitle());
When it's too good to be true, it's neither
30 REPLIES 30
Neo
Neo
Level VI

Re: How to use Filter Change Handler to work with Page option in Graph Builder?

@jthi Thanks. Upon initial checking, your first script works as expected (even with all unchecked). It gives expected y-axis title in all cases. Second script does not show the correct y-axis title in any case (always shows Median as the y-axis title).

I will spend some more time with the two scripts and come back if I have questions.

When it's too good to be true, it's neither