- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
I use the following to display "my text" at the top of my charts.
Dispatch( {}, "graph title", TextEditBox, {Set Text( "my text" )} )
However, I would like to have the item(s) selected in the local data filter to be displayed in the graph title as I select them (perhaps multiple sections as comma delimited?).
How to achieve this in JSL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
@hogi Your script below now works in JMP 16.2 but with the following issues.
- The chart starts with no age selected and no title shown but the last one remains shown on the chart title when all age checkboxes are unchecked.
- In the actual problem, the title starts showing only when more than one check boxes are checked.
How to resolve these two issues (unless this is my JMP version specific) ?
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = Graph Builder(
Size( 570, 518 ),
Show Control Panel( 0 ),
Variables( X( :height ), Y( :weight ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Conditional,
Add Filter(
columns( :sex, :age, :weight ),
Display( :sex, "Check Box Display" ),
Display( :age, "Check Box Display" )
)
),
SendToReport( Dispatch( {}, "graph title", TextEditBox, {Set Text( "" )} ) )
);
ldf = Current Report()["Local Data Filter"] << get scriptable object;
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
You are right.
If Regex doesn't find the age info, it returns missing.
So, after
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
please add
if(ismissing(ldfText),ldfText = "all ages");
to fix the issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
If you just select one entry at a time, you could use the page dropzone to automatically label the plot:
[if multiple entries are selected, the respective data gets split across multiple pages]
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
Graph Builder(
Variables( X( :height ), Y( :weight ), Page( :age ), Overlay( :sex ) ),
Elements( Points( X, Y, Legend( 1 ) ), Smoother( X, Y, Legend( 2 ) ) ),
Local Data Filter(
Add Filter(
columns( :sex, :age, :weight ),
Where( :age == 14 )
)
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
My script below (for the actual case) appears to be triggering only after the second check box selection. Any leads as to why would be useful.
changeTitle = Function( {this},
print(this);
ldfText = Regex(ldf << get where clause(),"\( *(:Parameter == .*?)\)","\1");
if(ismissing(ldfText),ldfText = " Selected Test Parameter ");
(Report( gb ) << XPath( "//TextEditBox" ))[4] << Set Text(ldfText);
);
fsh = ldf << Make Filter Change Handler(
changeTitle();
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
Oh, sorry, I always started by selecting the age - and then I missed that the title didn't update for the case of one age selection + something else.
If there is just a single age selection, there is no need for additional brackets.
So, how about skipping the first bracket ?
NB: please don't use inverse with this version
changeTitle = Function( {this},
print(this);
print(ldf << get where clause());
ldfText = Regex(ldf << get where clause(),"(:age == .*?)\)","\1");
if(ismissing(ldfText),ldfText = "any text you want");
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
Actually, this version should with Jmp 16.2.0:
- Chapters
- descriptions off, selected
- captions settings, opens captions settings dialog
- captions off, selected
This is a modal window.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
This is a modal window. This modal can be closed by pressing the Escape key or activating the close button.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
Bonjour à tous,
Comment on fait pour mettre une deuxième colonne dans le remplissage des titres automatiques ?
La colonne "name" ne fait pas parti du filtre des données locales, mais en fonction de la sélection des "ages" dans le filtre on aurait tous les noms correspondants à ces "ages" dans le titre du graphique. Tout ça de façon dynamique.
ldfText = Regex(ldf << get where clause(),"\( *(:age == .*?)\)","\1");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Is it possible to dynamically update "graph title" based item selection in local data filter (including multiple selections)?
Here is one approach in getting all of the names listed
changeTitle = Function( {this},
Eval( Parse( "theRows = dt << get rows where" || Substr( ldf << get where clause(), 13 ) ) );
If( Length( theRows ) > 0,
ldfText = Concat Items( :name[theRows],"," ),
ldfText = "All Names"
);
(Report( gb ) << XPath( "//TextEditBox" ))[1] << Set Text( ldfText );
);