Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send 'plotly_click' and 'plotly_selected' events to shiny when in shinyMode #416

Merged
merged 14 commits into from
Mar 2, 2016

Conversation

cpsievert
Copy link
Collaborator

@chriddyp @jp @cldougl

I talked to @jcheng5 today. He suggested that we don't yet rely on crosstalk, as it's still very experimental, and may never be officially supported.

Later I realized that, in #312, crosstalk is only used to send plotly event data to the shiny server. It turns out that isn't super hard to implement using shiny alone, so I've done that here.

Here is a barebones example (source)

To see how the interface for accessing plotly user event data has changed for those older examples, see cpsievert/apps@5633b6e (ignore the inline stuff, cc @pssguy)

A few things left to sort through:

  1. In the basic example above, notice that if you select point(s), then double click to unselect, the selection doesn't clear in the linked views. @etpinard, if possible, a 'plotly_doubleClick' event would be a huge help here!
  2. Do we want to support 'plotly_hover'? If so, that probably means we should clear the selection on 'plotly_unhover', but I imagine this quickly leads to glitchy behavior when hovering over a bunch of points.
  3. Should we provide an option to not send plotly user selections to shiny?

@jackparmer
Copy link
Contributor

Nice! ping @alexcjohnson re "plotly_doubleClick" event ^^^

@etpinard
Copy link

@cpsievert adding a doubleclick emitter would be a 2-line patch.

The only thing we need to discuss, is what the eventData should be on doubleclick?

The same as the old selection, an empty object, or something else?

@cpsievert
Copy link
Collaborator Author

@etpinard I don't think I have a preference for eventData as I'll probably send null regardless

@Vestaxis
Copy link

+1 from me too for plotly_doubleClick. Would be really great to have. Only reason why I'm occasionally using ggplot in Shiny apps.

etpinard referenced this pull request in plotly/plotly.js Feb 15, 2016
  on dragbox double clicks and select/lasso double clicks
@jackparmer
Copy link
Contributor

Hey @cpsievert , is it still possible to get plotly_hover and plotly_unhover in here? The folks over at climate corporation asked for it a few weeks ago, and I forgot about this PR being open.
(/cc @royr2 @charleyferrari @yankev )

@jackparmer
Copy link
Contributor

A few other folks are already trying to hack access to the hover events:
http://bl.ocks.org/ramnathv/dd524aa6ce9d90fc80cf
http://stackoverflow.com/questions/34031570/mouseover-in-plotly-and-shiny

cpsievert added a commit that referenced this pull request Mar 2, 2016
Send 'plotly_click' and 'plotly_selected' events to shiny when in shinyMode
@cpsievert cpsievert merged commit 63608e5 into master Mar 2, 2016
@cldougl
Copy link
Member

cldougl commented Mar 2, 2016

Nice!!!

@jackparmer
Copy link
Contributor

🎉 🎉 🎉

@cpsievert cpsievert deleted the feature/transmit branch March 13, 2016 23:40
@tmhdunn
Copy link

tmhdunn commented Mar 23, 2016

Is there any possibility of getting plotly click event data for the white space? Would be useful in making something where the user can click to add data points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants