Skip to content

Coordinated plots #1984

Answered by Fil
yurivish asked this question in Q&A
Feb 8, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

This is difficult, since you need to make sure you don't have circular effects.

To answer the first question "to get the ID of the point that is hovered in the Plot": you can do viewof hovered = Plot.plot({…, and in a separate cell do

{
  if (hovered?.id && hovered.id !== mutable selectedPointId)
    mutable selectedPointId = hovered?.id;
}

This will set the value of selectedPointId when you mouse over the chart. However it will not highlight that point on the map. To do so, you will have to restructure the code a bit more, so you can manipulate the Leaflet markers without re-generating the whole map. I've sent you a suggestion in https://observablehq.com/compare/a1c5edd0489f4478...caec8…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@landisrm
Comment options

@Fil
Comment options

Fil Sep 3, 2024
Collaborator

Answer selected by Fil
@landisrm
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants