I use the Make Filter Change Handler () to dynamically change the y-axis title based on changes made by the user on the local data filter. The script uses solution by @hogi from here. However, in my example case (script below) which represents my actual case closely, the y-axis title is changes only after the second checkbox is checked on "age". How to make the y-axis tile change upon the first age selection (I am on JMP 16.2.0)?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
Size( 855, 687 ),
Show Control Panel( 0 ),
Variables( X( :name ), Y( :age ), Group Y( :height ) ),
Elements( Points( X, Y, Legend( 37 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age ),
Where( :sex == "F" ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport(
Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ),
Dispatch( {}, "Y title", TextEditBox, {Rotate Text( "Left" )} )
)
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
if(ismissing(ldfText),ldfText = "all ages");
(Report( gb ) << XPath( "//TextEditBox" ))[4] << Set Text( ldfText );
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);
When it's too good to be true, it's neither