Choose Language Hide Translation Bar
Highlighted
avner8943
Occasional Contributor

Adding graph to JMP application or new window disable MakeRowStateHandler

gb = dt << Graph Builder(

       Size( 865, 775 ),

       Show Control Panel( 0 ),

       Fit to Window( "Off" ),

       Variables( X( :TIME_col ), X( :col2 ), Y( :col1 ), Y( :col2), Group X( :group_leg), Overlay( :leg_col) ),

       Elements( Position( 1, 1 ), Points( X, Y, Legend( 36 ) ), Smoother( X, Y, Legend( 48 ) ) ),

       Elements( Position( 1, 2 ), Points( X, Y, Legend( 38 ) ), Smoother( X, Y, Legend( 49 ) ) ),

       Elements( Position( 2, 1 ), Points( X, Y, Legend( 40 ) ), Line Of Fit( X, Y, Legend( 24 ), R²( 1 ) ) ),

       Elements( Position( 2, 2 ), Points( X, Y, Legend( 42 ) ), Smoother( X, Y, Legend( 51 ) ) ),


);

 

ldf = gb << Local Data Filter(

       Add Filter(

             columns( :leg_col, :group_col),

             Display( :leg_col, Size( 160, 60 ), List Display ),

             Display( :group_col, Size( 160, 60 ), List Display ),


             Order By Count( :group_col)

       )


);

 

cso1 = gb << Column Switcher( :leg_col, legend_cls ); // legend_cls  is list of cols

cso2 = gb << Column Switcher( :col1, num_cls ); // num_cls is list of cols

cso3 = gb << Column Switcher( :col2, num_cls );

cso4 = gb << Column Switcher( :TIME_col, time_cls );// time_cls is list of cols


cso1 << Set Size( 200 );

cso1 << Set NLines( 6 );

cso2 << Set Size( 200 );

cso2 << Set NLines( 15 );

cso3 << Set Size( 200 );

cso3 << Set NLines( 15 );

cso4 << Set Size( 200 );

cso4 << Set NLines( 10 );


 

// Row state handler function

doSomethingWithSelection = Function( {x},

       {Default Local},

       currentScript = ldf << getScript;

       Clear Log();

       str = Char( Name Expr( currentScript ) );

       prodi = Left( Substr( str, Contains( str, "Where(:Prod == " ) + 16 ), 4 );

      

       response = cso2 << Get current;

       predictor = cso3 << Get Current;


      // dt_lims is data table of control limits

       TR1_row = dt_lims << get rows where( :Label == response & :Prod == prodi );

 

       ::TR_res = Column( dt_lims, "CL" )[TR1_row];


       Try( gbreport[FrameBox( 1 )] << Add Graphics Script( H Line( TR_res ) ) );

       TR2_row = dt_lims << get rows where( :Label == predictor & :Prod == prodi );

       ::TR_pred = Column( dt_lims, "CL" )[TR2_row];

       Show( TR_pred );


       Try( gbreport[FrameBox( 2 )] << Add Graphics Script( H Line( TR_pred ) ) );

      

);


// Get a reference to the report

gbReport = Report( gb );



// Assign the row state handler to the local data filter display box

rsh1 = gbReport[Outline Box( 1 )] << MakeRowStateHandler( doSomethingWithSelection );

 

Hi, I have a script that using Local Data Filter in Graph Builder object. I wrote a function that draws a different line in the chart when I switch selection in the local data filter. It's working fine in the Graph Builder window, but if I try to put in a new window or into JMP app, it ignores the function and does not draw the line.

 

Anybody knows why?

 

Edit:  I joined my code.

 

 

0 Kudos
2 REPLIES 2
txnelson
Super User

Re: Adding graph to JMP application or new window disable MakeRowStateHandler

My guess would be that you are using a relative reference to the Frame Box(), and when it incapsulated into an additional object (New Window), the reference is no longer valid.

 

Other things may be going on, so it would be very helpful if you could provide more specifics of you code, or even better yet, the code itself.

Jim
0 Kudos
avner8943
Occasional Contributor

Re: Adding graph to JMP application or new window disable MakeRowStateHandler

Added the script
0 Kudos