cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
FN
FN
Level VI

Showing statics of highlighted points in Graph Builder

I am plotting some sensor data stacking several Ys (sensor readings)  with one X (date time) in the graph builder.

 

If I want to get the value of all the Ys for the rows I am selecting I need to move my mouse sensor by sensor using the crosshair.

 

I wonder if there is a way to use caption boxes (or similar) in the graph building that summarize selected rows (data points) only.

 

The solution should avoid the use of JSL coding if possible, as this functionality is meant for users learning JMP.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Showing statics of highlighted points in Graph Builder

Hi,

 

As Jeff mentions:

 

1) Add a new column to your table, name it "Selected", then right click on the column header, select Formula and enter this formula:

 

selected ( row state ( ) )

This formula results in the cell value == 1 when the row is selected, and 0 if not.

 

2) Right-click on the Selection column, select Column Properties, and change the modeling type to Nominal.

 

3) Build your graph with Graph Builder.

 

4) Use Tabulate to make a table with the statistics you want, using the Selected column as a grouping column.

 

5) In the Tabulate report, invoke a Local Data Filter, using the Selection column. Choose the 0 (zero) level, and click the "Inverse" checkbox. The reason for this is that the "1" level will not initially show up if there are no rows selected, so we use the "0" level and invert.

 

Now, the summary will reflect whichever rows are selected (no matter where you select them).

 

I've pasted a script below so you can see the result easily. The script creates a random table in which half of the rows are selected, a Graph Builder graph, and a Tabulate report with a Local Data Filter.

 

Cheers,

Brady

 

 

Names Default To Here(1);

dt = astable(J(20,2, randomuniform()));
dt << new column("Selected", nominal, formula(selected(row state())));
dt << select randomly (0.5);

dt << Graph Builder(
	Size( 526, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Col2 ), Y( :Col1 ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 3 ) ) )
);

dt << Tabulate(
	Show Control Panel( 0 ),
	Add Table(
		Row Table(
			Analysis Columns( :Col1 ),
			Grouping Columns( :Selected ),
			Statistics( Sum, Mean )
		)
	),
	Local Data Filter(
		Show Histograms and Bars( 0 ),
		Inverse( 1 ),
		Add Filter( columns( :Selected ), Where( :Selected == 0 ) )
	)
);

brady_brady_0-1623856257017.png

 

 

View solution in original post

3 REPLIES 3
Jeff_Perkinson
Community Manager Community Manager

Re: Showing statics of highlighted points in Graph Builder

@brady_brady has a creative solution here using row states to create groups automatically as you select and then using a data filter attached to Tabulate (or other platforms). I can't quite remember how to make it work but perhaps by tagging him here he'll remind us all.

-Jeff

Re: Showing statics of highlighted points in Graph Builder

Hi,

 

As Jeff mentions:

 

1) Add a new column to your table, name it "Selected", then right click on the column header, select Formula and enter this formula:

 

selected ( row state ( ) )

This formula results in the cell value == 1 when the row is selected, and 0 if not.

 

2) Right-click on the Selection column, select Column Properties, and change the modeling type to Nominal.

 

3) Build your graph with Graph Builder.

 

4) Use Tabulate to make a table with the statistics you want, using the Selected column as a grouping column.

 

5) In the Tabulate report, invoke a Local Data Filter, using the Selection column. Choose the 0 (zero) level, and click the "Inverse" checkbox. The reason for this is that the "1" level will not initially show up if there are no rows selected, so we use the "0" level and invert.

 

Now, the summary will reflect whichever rows are selected (no matter where you select them).

 

I've pasted a script below so you can see the result easily. The script creates a random table in which half of the rows are selected, a Graph Builder graph, and a Tabulate report with a Local Data Filter.

 

Cheers,

Brady

 

 

Names Default To Here(1);

dt = astable(J(20,2, randomuniform()));
dt << new column("Selected", nominal, formula(selected(row state())));
dt << select randomly (0.5);

dt << Graph Builder(
	Size( 526, 454 ),
	Show Control Panel( 0 ),
	Variables( X( :Col2 ), Y( :Col1 ) ),
	Elements( Points( X, Y, Legend( 2 ) ), Smoother( X, Y, Legend( 3 ) ) )
);

dt << Tabulate(
	Show Control Panel( 0 ),
	Add Table(
		Row Table(
			Analysis Columns( :Col1 ),
			Grouping Columns( :Selected ),
			Statistics( Sum, Mean )
		)
	),
	Local Data Filter(
		Show Histograms and Bars( 0 ),
		Inverse( 1 ),
		Add Filter( columns( :Selected ), Where( :Selected == 0 ) )
	)
);

brady_brady_0-1623856257017.png

 

 

FN
FN
Level VI

Re: Showing statics of highlighted points in Graph Builder

Nice hack!

 

It seems that a formula containing Selected() will work as well.

 

I can also use this column in Overlay, so I see the mean in the caption for all the plotted trends.