FYI, another approach using the row state handler:
Names Default To Here( 1 );
// Table
dt = New Table( "Bivariate ID Selection",
Add Rows( 10 ),
New Column( "ID", Numeric, "Nominal", Format( "Best", 12 ), Set Values( [2014, 2011, 2012, 2013, 2014, 2011, 2013, 2012, 2011, 2014] ) ),
New Column( "X", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ) ),
New Column( "Y", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [20, 21, 25, 28, 30, 31, 33, 36, 37, 40] ) ),
Set Label Columns( :ID )
);
// Row state handler function
selectMatchingID = Function( {x},
// Get which rows are currently selected
selectedRows = [];
i = 1;
For Each Row(
If( Selected( Row State() ),
selectedRows = V Concat( selectedRows, i )
);
i++;
);
// If there is a selection, 'expand' it to all required rows
If( N Row( selectedRows ) > 0,
expandedSelectedRows = [];
For( i = 1, i <= N Row( selectedRows ), i++,
thisID = :ID[selectedRows[i]];
matchingRows = dt << getRowsWhere( :ID == thisID );
expandedSelectedRows = V Concat( expandedSelectedRows, matchingRows );
);
dt << selectRows( expandedSelectedRows );
);
);
// Assign the handler to the table
rsh = dt << MakeRowStateHandler( selectMatchingID );
// Try it out with Graph Builder
dt << Graph Builder(
Size( 530, 454 ),
Show Control Panel( 0 ),
Variables( X( :X ), Y( :Y ) ),
Elements( Points( X, Y, Legend( 5 ) ), Smoother( X, Y, Legend( 6 ) ) )
);