I'm building linked selection across a set of By-group Bivariate plots. The plots come from a long-format table (one row per ID per Mode):
dt << Bivariate(
Y( dt:Y ),
X( dt:X ),
By( :MODE )
);
What I want: when I click a point in one of the By-group graphs, I want every point in the other graphs that shares the same :ID to also become selected. I'd like to do this without reshaping the table to wide format (one row per ID).
What I tried: I found that a row state handler can re-select all rows for the matching IDs. My current implementation:
f = Function( {row},
rows = dt << Get Selected Rows;
units = Associative Array( dt:ID[rows] ) << Get Keys;
dt << Select Where( Contains( units, :ID ) );
);
rs = dt << Make Row State Handler( f );
The problem: this works for the first selection only in the data table. After that the handler behaves as if it no longer exists.
My questions:
1. Why does the row state handler stop firing after the first selection? (I'm wondering whether changing row states inside the handler is what's tearing it down.)
2. Is there a way to fix this so the handler stays active across repeated selections?
3. Are there better approaches to ID-linked selection across By-group plots that I should consider instead?
Thanks in advance.