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

Can I get local data filter selected x-axis parameters (in graph builder) in a list?

I want to get the x-axis parameters (in graph builder) selected by my local data filter selection as a list to use in another script. Is it possible to do this via JSL?

When it's too good to be true, it's neither
1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Can I get local data filter selected x-axis parameters (in graph builder) in a list?

<< Get Filtered Rows returns you a matrix of selected rows, you can use this matrix to access values in table (and columns). One option is

:Latitude[f << get filtered rows];

Data table subscripting can also be helpful.

 

I don't know what you are doing so it is a bit difficult to give advice on second question (filter change handler or using a button most likely).

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:Latitude), Y(:POP)),
	Elements(Points(X, Y, Legend(7)), Smoother(X, Y, Legend(8)))
);

f = gb << Local Data Filter(
	Add Filter(
		columns(:city),
		Where(
			:city == {"ALBANY", "ALBUQUERQUE", "ATLANTA", "ATLANTIC CITY",
			"BALTIMORE", "BOSTON", "BURLINGTON"}
		),
		Display(:city, N Items(15), Find(Set Text("")))
	)
);

filter_f = Function({a}, show(:Latitude[f << get filtered rows]));
rs = f << Make Filter Change Handler(filter_f);
-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: Can I get local data filter selected x-axis parameters (in graph builder) in a list?

Yes. You can use for example << Get Filtered Rows and then select the values of interest based on those from the correct column (when nothing is being filtered it is a special case you might have to take care of).

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:Latitude), Y(:POP)),
	Elements(Points(X, Y, Legend(7)), Smoother(X, Y, Legend(8)))
);

f = gb << Local Data Filter(
	Add Filter(
		columns(:city),
		Where(
			:city == {"ALBANY", "ALBUQUERQUE", "ATLANTA", "ATLANTIC CITY",
			"BALTIMORE", "BOSTON", "BURLINGTON"}
		),
		Display(:city, N Items(15), Find(Set Text("")))
	)
);

f << get filtered rows;
-Jarmo
Neo
Neo
Level VI

Re: Can I get local data filter selected x-axis parameters (in graph builder) in a list?

@jthi Thanks.

This gives the row index. How to get the the actual Latitudes (loop the column through f)?

Secondly how to get new 'f' values should the local data filter selection be changed by the user (I am thinking filter change handler, but never got to get it to work as desired),?

When it's too good to be true, it's neither
jthi
Super User

Re: Can I get local data filter selected x-axis parameters (in graph builder) in a list?

<< Get Filtered Rows returns you a matrix of selected rows, you can use this matrix to access values in table (and columns). One option is

:Latitude[f << get filtered rows];

Data table subscripting can also be helpful.

 

I don't know what you are doing so it is a bit difficult to give advice on second question (filter change handler or using a button most likely).

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Cities.jmp");

gb = dt << Graph Builder(
	Size(534, 456),
	Show Control Panel(0),
	Variables(X(:Latitude), Y(:POP)),
	Elements(Points(X, Y, Legend(7)), Smoother(X, Y, Legend(8)))
);

f = gb << Local Data Filter(
	Add Filter(
		columns(:city),
		Where(
			:city == {"ALBANY", "ALBUQUERQUE", "ATLANTA", "ATLANTIC CITY",
			"BALTIMORE", "BOSTON", "BURLINGTON"}
		),
		Display(:city, N Items(15), Find(Set Text("")))
	)
);

filter_f = Function({a}, show(:Latitude[f << get filtered rows]));
rs = f << Make Filter Change Handler(filter_f);
-Jarmo
txnelson
Super User

Re: Can I get local data filter selected x-axis parameters (in graph builder) in a list?

You can also retrieve the specifics of the X and Y axes, by requesting to get the Min, Max, Incr.  Here is a modification that retrieves the Maximum value of the Y axis

filter_f = Function({a}, show(:Latitude[f << get filtered rows]);
	show("Max", report(gb)[axisbox(2)]<<get max)
);
rs = f << Make Filter Change Handler(filter_f);
Jim