- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Filter value to grah name
Hi. Can anyone please help me with a script to name my graph with the value of my filter. Thanks!
4 REPLIES 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Filter value to grah name
Could you provide more information? Which graph you want to name and how you want to name it?
In general I use Group X for "naming" my graphs when I have Local Data Filter. This helps users to see how it has been filtered, especially helpful if there is lots of options.
-Jarmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Filter value to grah name
Thanks for the reply. In your example, I would like to take the graph title "height vs. age" and replace it with the selected filter "F".
Thanks again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Filter value to grah name
This will require scripting to my knowledge and it wasn't as simple as I thought it would be... hopefully there are easier methods to do this than the example I have here:
Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");
gb = dt << Graph Builder(
Size(529, 451),
Show Control Panel(0),
Variables(X(:age), Y(:height)),
Elements(Points(X, Y, Legend(11))),
);
filter = gb << Local Data Filter(Add Filter(columns(:sex), Where(:sex == "F")));
//filter = gb << Local Data Filter(Add Filter(columns(:age), Where(:age == 12)));
f = Function({a},
cur_filter_script = filter << Get Script;
filtered_values = Parse(Word(2, Char(Arg(Arg(Arg(cur_filter_script, 1), 2), 1)), "=="));
If(Type(filtered_values) == "List",
num_to_str = Transform Each({val}, filtered_values, char(val));
title = Concat Items(num_to_str, ", ");
,
title = char(filtered_values);
);
// set title changes wrong text (outline box)
// but << Show Title() controls correct one
// so we edit report layer
Report(gb)[TextEditBox(1)] << Set Text(title);
);
rs = filter << Make Filter Change Handler(f);
-Jarmo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Filter value to grah name
Awesome! Thank you. I'll give this a shot.