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

Dynamically put selected Local Data Filter parameter to y-axis label on a chart

I have got a three column data. Column - 1 is "Part ID", Column-2 is "Tested Parameter Name" and Column - 3 is "Measured value" of each tested parameter.

There are five test parameters for each part so the Part ID changes after every 5 row entries.

I am plotting "Measured value" of the tested parameter on y-axis and "Part ID" on the x-axis.

I have got local data filter open on the "Tested Parameter Name" column, where I select one tested parameter name to see the corresponding data trend with PartID. Please see example below.

I want to dynamically include the "Tested Parameter Name" on the y-axis label as I select the parameter on the local data filter.

e.g. I want the y-axis label as Measured value of "Name", where "Name" is the selected item on the local data filter.

Is this doable in JSL, if so how? 

 

Neo_0-1676395321446.png

 

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

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

One option would be to use the local data filter also as Group X

jthi_0-1676396551287.png

Or you can use it as Group Y and move that to left side

jthi_1-1676396609774.png

You could also split the data and use column data switcher instead of local data filter, this is most likely the best option

jthi_2-1676396708409.png

 

I would try out these options before testing Filter Change Handler.

-Jarmo
Neo
Neo
Level VI

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

@jthi. Thanks but I do not see how column switcher could be used in my case as I am switching between rows within a column "Tested Parameter Name" using the local data filter. I attach my example data table with chart script saved in it.

(The other options you have suggested is not how I want my charts to look) 

 

Could I please have an example on how to use Filter Change Handler?

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

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

First split your data by Tested parameter Name and then plot it using Column Switcher

Names Default To Here(1);

dt = Open("$DOWNLOADS/ExampleDataTable.jmp");

dt_split = dt << Split(
	Split By(:Tested parameter Name),
	Split(:Measured Value),
	Group(:Part ID),
	Output Table("ExampleDataTable_SPLIT"),
	Sort by Column Property
);
Close(dt, no save);

gb = dt_split << Graph Builder(
	Size(534, 450),
	Show Control Panel(0),
	Variables(X(:Part ID), Y(:"Capacitance1 [pF]"n)),
	Elements(Points(X, Y, Legend(5)), Smoother(X, Y, Legend(7))),
	Column Switcher(
		:"Capacitance1 [pF]"n,
		{:"Capacitance1 [pF]"n, :"Capacitance2 [pF]"n, :slope, :"Voltage1 [V]"n,
		:"Voltage2 [V]"n}
	)
);

For Filter Change Handler you can get examples from help page or from scripting index, you also need a way to change the Y-axis title (if I remember correct it is just a text box).

 

-Jarmo
Neo
Neo
Level VI

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

@jthi. Thanks. I would prefer to work with the Filter Change handler (I would not prefer row/column split given the amount of data I have, may become confusing).

I see that the Filter Change Handler returns the number of rows within the selected item. How to return the name of the selection (and not number of rows) which is what I need?

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

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

Use Filter Change Handler to detect change in filter (change might not be what you except every time, but it might not matter in this case). Then in the function you use with the handler, you can for example get the filtered rows and based on those rows check which Tested parameter Names have been selected, get unique values of those, build the string and then update the y-axis title.

-Jarmo
Neo
Neo
Level VI

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

@jthi . Thanks but the number of rows for each Tested Parameter is the same in my dataset, so I cannot differentiate Tested Parameter Names based on the number of rows returned by the function when each Tested Parameter Name is selected via the local data filter. If the handler returned the row name or row index it would do just fine. Am I missing something, if not what are my alternatives?

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

Re: Dynamically put selected Local Data Filter parameter to y-axis label on a chart

Most likely split data with column switcher is still the best option.

Use the handler only to detect when filter value has been updated (you can ignore the number of  rows). When you have the filter change handler you should:

  1. be able to detect when filter gets updated
  2. use reference to your filter to get filtered rows. Scripting index has function for this, I think it is something like << get filtered rows
  3. based on those rows from step 2 you can get values from Tested parameter name column
  4. get unique list of those values from step 3 (associative array << get keys might be enough in this case)
  5. build title string based on list from step 4
  6. update graph builder's y-axis with that created title from step 5
-Jarmo