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

Is it possible to apply the same data filter to two separate graphs from two different data tables

I am writing a script for a report that automatically imports, rearranges and then produces all the relevant graphs and statistical analyses in the one screen as a final report. I wish for bar chart and area plot (produced from dt and dt3 respectively - see below) in the report to have the same data filter applied to them, which changes both the plots simultaneously. However, I can only get the one graph to change with the data filter - any suggestions? I've included the relevant part of my script below: Also I'm aware the layout isn't the best at the moment, but as I'm pretty new to this scripting thing, I'm just trying to tackle one issue at a time. Thanks!

dt:Sample ID << Set Property( "Link ID", 1 ); 
dt3:Sample ID << Set Property( "Link Reference", Reference Table( dt ) ); 
jrnl = New Window( "Screening Summary", <<Report );
jrnl << Append(
	H List Box(
		(dt_main << Fit definitive screening(
			Y( :Y1, :Y2 ),
			X( :X1, :X2, :X3 ),
			SendToReport( Dispatch( {"Main Effects Plot"}, "FitDefinScreeningPlatform", FrameBox( 4 ), {Frame Size( 44, 38 )} ) )
		) ; <<Report);
		V List Box(
			H List Box(
				dt_main << Contour Plot( X( :X1, :X2 ), Y( :Y1 ), Fill Areas( 1 ) );
				dt_main << Contour Plot( X( :X1, :X2 ), Y( :Y2 ), Fill Areas( 1 ) );
				Data Filter Context Box(
					V List Box(
						dt_main << Data Filter( Add filter( columns( :X1, :X2, :X3 ) ) ),
						H List Box(
							dt_main << Graph Builder(
								Size( 450, 450 ),
								Show Control Panel( 0 ),
								Variables(
									Y( :Name( "Dx (10)" ) ),
									Y( :Name( "Dx (50)" ), Position( 1 ) ),
									Y( :Name( "Dx (90)" ), Position( 1 ) ),
									Wrap( :Sample ID )
								),
								Elements( Bar( Y( 1 ), Y( 2 ), Y( 3 ), Legend( 13 ) ) ),

							),
							dt3 << Graph Builder(
								Size( 450, 450 ),
								Show Control Panel( 0 ),
								Variables(
									X( Transform column( "Log10[X]", Formula( Log10( :Name( "J" ) ) ) ) ),
									Y( :K),
									Wrap( :Sample ID )
								),
								Elements( Area( X, Y, Legend( 0 ) ) )
							),

						)
					)
				);
			)
		);
	)
);
3 REPLIES 3
txnelson
Super User

Re: Is it possible to apply the same data filter to two separate graphs from two different data tabl

By using  "Make Row State Handler", "Data Table Subscriptions" and "Add Graphic Scripts" you should be able to determine changes made in one Data Filter, and then through JSL, make the changes in the second Data Filter.

Jim
nhun
Level II

Re: Is it possible to apply the same data filter to two separate graphs from two different data tabl

Would all of these need to be contained within the Data filter context? 

txnelson
Super User

Re: Is it possible to apply the same data filter to two separate graphs from two different data tabl

No.  As I envision it, the data filter changes the Row State column , the Row State Handler would be triggered, and it would contain the code to make the changes in the other data table and charts.  Or if you used a Graphic Script, the script would detect the changes in the graph due to the data filter, and then would make the calls to the other data filter, or to the graphs from the other data table to adjust their displays.

Jim