Synchronized input with linked datasets

I am working on a couple map examples. I was using this notebook as a starting point - Keeping inputs and views synchronized / Brianna Wilson | Observable. I am trying to link the state inputs to the bills dataset - so if multiple states are selected the horizontal bar will add the names in the y channel.

I am using the following to link the 2 datasets:

filter_vote = bills.filter(d => d.name === selectedStates[0].properties.name)

My example notebook is here - grid_map / mferro64 | Observable

Thanks for any help,

Mike

1 Like

Can you add a static example of what you expect the result to look like?

I created an example using checkbox input - ideally I want to use the map as the input for multiple selections

Is this what you’re looking for?

filter_vote = {
  const names = new Set(selectedStates.map(d => d.properties.name));
  return bills.filter(d => names.has(d.name));
}

By the way, I would try to choose a different wording than “synchronized”. In the context of Observable and inputs, “synchronized” is commonly understood as two-way binding between inputs, while your use case appears to “just” involve the downstream dataflow. :slight_smile:

Thanks for the help! - that worked and I will take that into account when I write a title for the post