Skip to content

Allow on/off to accept multiple values #978

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

Open
talgalili opened this issue Apr 26, 2017 · 8 comments
Open

Allow on/off to accept multiple values #978

talgalili opened this issue Apr 26, 2017 · 8 comments

Comments

@talgalili
Copy link
Contributor

Code:

library(plotly)
library(crosstalk)
D <- SharedData$new(iris, key = ~Species) 
scatter <- ggplot(data=D, aes(x = Sepal.Length, y = Sepal.Width)) 
p <- scatter + geom_point(aes(color=Species, shape=Species)) +
  xlab("Sepal Length") +  ylab("Sepal Width") +
  ggtitle("Sepal Length-Width")
highlight(ggplotly(p), on = "plotly_selected",  off = 'plotly_deselect')

Step 1, I select the red group:

image

Step 2, I click somewhere else in the plot: (here is the BUG, it acts the same as off = 'plotly_doubleclick' )

image

Using double click releases the fading.

@cpsievert
Copy link
Collaborator

I'm not sure I understand, and I can't replicate step 2. Do you see any errors on the web console?

@talgalili
Copy link
Contributor Author

mmm,
I just realized the behavior is different for when I run the code from Rgui, and when I run it from RStudio.
With RStudio, 'plotly_deselect' works as 'plotly_doubleclick'. 'plotly_doubleclick' doesn't work. And "plotly_relayout" means that when I deselect, I am just left with everything greyed out.

> sessionInfo()
R version 3.3.0 (2016-05-03)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=Hebrew_Israel.1255  LC_CTYPE=Hebrew_Israel.1255    LC_MONETARY=Hebrew_Israel.1255
[4] LC_NUMERIC=C                   LC_TIME=Hebrew_Israel.1255    

attached base packages:
[1] stats     graphics  grDevices datasets  utils     methods   base     

other attached packages:
[1] crosstalk_1.0.0    plotly_4.6.0       ggplot2_2.2.1.9000 installr_0.19.0    stringr_1.2.0     

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10      cluster_2.0.4     magrittr_1.5      munsell_0.4.3     xtable_1.8-2     
 [6] viridisLite_0.2.0 colorspace_1.3-2  R6_2.2.0          httr_1.2.1        plyr_1.8.4       
[11] dplyr_0.5.0       tools_3.3.0       grid_3.3.0        gtable_0.2.0      DBI_0.6-1        
[16] htmltools_0.3.5   yaml_2.1.14       lazyeval_0.2.0    assertthat_0.2.0  digest_0.6.12    
[21] tibble_1.3.0      shiny_1.0.2       tidyr_0.6.1       purrr_0.2.2       htmlwidgets_0.8  
[26] rpart_4.1-10      mime_0.5          labeling_0.3      stringi_1.1.5     scales_0.4.1     
[31] jsonlite_1.4      httpuv_1.3.3      Cairo_1.5-9      

@cpsievert
Copy link
Collaborator

cpsievert commented Apr 27, 2017

Just FYI, doubleclick is tied to a doubleclick when in zoom mode

Information about RStudio and web console errors (if any) are going to be more helpful than session info for these sort of problems...gifs would also help

@cpsievert
Copy link
Collaborator

cpsievert commented Apr 27, 2017

Oh...I think I might know what's happening...

Although you think you've clicked, I'm guessing you've clicked and dragged just a tiny bit (and thus, didn't select anything). Not sure if that should be considered user error or not...

@cpsievert cpsievert changed the title "off" ignores 'plotly_deselect' in highlight Allow on/off to accept multiple values Apr 27, 2017
@cpsievert
Copy link
Collaborator

I think the main problem here is that you are expecting both 'plotly_doubleclick' and 'plotly_deselect'to clear the selection. Chalking this up as reason for multiple values in on/off

@talgalili
Copy link
Contributor Author

talgalili commented Apr 27, 2017 via email

@talgalili
Copy link
Contributor Author

talgalili commented May 17, 2017

BUMP

Hi Carson,
I see that you are getting closer to a CRAN release.
If this specific feature could be added (i.e.: " to mark observations, and then that a single click would release them."), this would be very helpful for my work.

Thanks,
Tal

@cpsievert
Copy link
Collaborator

I wish to mark observations, and then that a single click would release them.

This is a bad idea unless you define a target for the single-click. Let's move any future discussion to #1016

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

No branches or pull requests

2 participants