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
lehaofeng
Level V

How can I automatically draw a graph in a JMP table based on user-selected rows?

I have a problem now: there is a JMP table and then after selecting a row, a histogram needs to be drawn automatically. That is to say, different histograms appear for different rows, and the graph should be updated automatically after changing the value of the rows when data anomalies are detected.
But now I've searched, only dt<<get selected rows();

on change is not for JMP table either.

For example: set row change function() is for tablebox.

Thanks

4 REPLIES 4
txnelson
Super User

Re: How can I automatically draw a graph in a JMP table based on user-selected rows?

I am having a tough time understanding how your data are arranged, and how you are generating histograms from a single row of data.

Could you please provide a sample or a more specific description of your data table, and the method you are using to generate your histograms?

 

The typical way to trigger based upon a change in row selection, is to use 

     Make Row State Handler

Any change in the row selections, will run any script placed in the Row State Handler.

 

I will also point you to the use of a Data Filter, or a Column Switcher.  Both of these features in JMP can be used to select specific data and then to apply the selected data to one or more displays.

Jim
lehaofeng
Level V

Re: How can I automatically draw a graph in a JMP table based on user-selected rows?

My raw table is just a lot of data values, some obviously wrong ones that need to be changed manually, with dynamic display images

 

Names Default To Here( 1 );
dt = Current Data Table();

//Get the row number of the selected row in the current table

While( 1,
	r = dt << get selected rows();

	dt1 = New Table( "w", New Column( "x", set values( dt[r, 1 :: 13] ) ) );
	dt1 << Distribution(
		Stack( 1 ),
		Continuous Distribution( Column( :x ), Horizontal Layout( 1 ), Vertical( 0 ) )
	);
    //Check if there is a change in the selected row number in the original table, and redraw the diagram if it has changed
	If( (r1 = dt << get selected rows()) != r,
		dt1 = New Table( "w", New Column( "x", set values( dt[r1, 1 :: 13] ) ) );
		dt1 << Distribution(
			Stack( 1 ),
			Continuous Distribution( Column( :x ), Horizontal Layout( 1 ), Vertical( 0 ) )
		);
	);
	
	//Check if any values in the original table have been modified, and if so, redraw the graphs
	If( (r2 = dt << get selected rows()) == r | (r2 = dt << get selected rows()) == r1,
		If( dt[r, 1 :: 13] != dt[r2, 1 :: 13] | dt[r2, 1 :: 13] != dt[r1, 1 :: 13],
			dt1 = New Table( "w", New Column( "x", set values( dt[r1, 1 :: 13] ) ) );
			dt1 << Distribution(
				Stack( 1 ),
				Continuous Distribution( Column( :x ), Horizontal Layout( 1 ), Vertical( 0 ) )
			)	

			;
		)
	);
    
txnelson
Super User

Re: How can I automatically draw a graph in a JMP table based on user-selected rows?

If you have to have your data laid out in a row centric fashion, then I believe your best bet will be to use a Row State Handler.  However, if you would transpose to a column centric structure, you will fit better into the normal operation of JMP.  Any of the histograms you produce will automatically be update when you change data in the data table. All that has to be done to do this, is to set the Autocalc option for the Distribution Platform.

You can easily create a simple selector window, to select the columns as you do now with the rows, and once selected, your scripts can generate the histogram as you desire.

Jim
lehaofeng
Level V

Re: How can I automatically draw a graph in a JMP table based on user-selected rows?

Thanks Jim! That is helpful.

This raw data table is automatically downloaded from the database, that is, in rows;

in addition to rows with set row handler(), I can get the row number in real time,

so for the numbers manually modified, what is the way to be informed in real time?

Also I use autocal(1), I change the value, but the distribution platform does not change automatically.