Lchiffon / wordcloud2

R interface to wordcloud for data visualization.
397 stars 113 forks source link

Issues with Hover and Click #45

Closed AdamSpannbauer closed 6 years ago

AdamSpannbauer commented 6 years ago

The most recent merged PR from @JacobXPX seems to have issues with hover info and issues with click events when rendering multiple wordcloud2s. I have not yet had time to look into what causes the issue, but I know the issues weren't present in my initial PR (based on the example apps shown below).

Please let me know if these issues are not reproducible or if they are due to user error. If these are consistent issues then I think they should be resolved before the next push to CRAN.

All example output below are from running the github version of wordcloud2 in Chrome.

Issues with multiple wordcloud2s:

devtools::install_github('Lchiffon/wordcloud2')

library(shiny)
library(wordcloud2)
shinyApp(
  ui=shinyUI(fluidPage(
    #using default clicked word input id
    wordcloud2Output("my_wc"),
    #using custom clicked word input id
    wordcloud2Output("my_wc2", clickedWordInputId = "wc2_clicked_word"),

    verbatimTextOutput("print"),
    verbatimTextOutput("print2")
  )),
  server=shinyServer(function(input,output,session){
    output$my_wc  = renderWordcloud2(wordcloud2(demoFreq))
    output$my_wc2 = renderWordcloud2(wordcloud2(demoFreq))

    #using default clicked word input id
    output$print  = renderPrint(input$selected_word)
    #using custom clicked word input id
    output$print2 = renderPrint(input$wc2_clicked_word)
  })
)

Issues with single wordcloud2

devtools::install_github('Lchiffon/wordcloud2')

library(shiny)
library(wordcloud2)
shinyApp(
  ui=shinyUI(fluidPage(
    #using default clicked word input id
    wordcloud2Output("my_wc"),

    verbatimTextOutput("print")
  )),
  server=shinyServer(function(input,output,session){
    output$my_wc  = renderWordcloud2(wordcloud2(demoFreq))

    #using default clicked word input id
    output$print  = renderPrint(input$selected_word)
  })
)
AdamSpannbauer commented 6 years ago

At a glance it looks like the changes @JacobXPX made to the hover.js file essentially undoes all the changes @AdeelK93 made to ensure unique wordcloud2 ids in PR #32 (which fixed issue #18)

jacobyxu commented 6 years ago

Respected all,

As I remembered, when I used it, It's not clickable and not showing hover info.That's the reason why I undoes it. I'm using Ubuntu, also test on firefox.

Thank you!

AdamSpannbauer commented 6 years ago

Testing in Firefox gives me about the same issues as described above.

Of note, I reverted back to an earlier commit (before the revisions to hover.js), and there are issues with click/hover in firefox, despite working well in chrome.

jacobyxu commented 6 years ago

I just fixed the firefox issue. Will try to fix the click on multiple clouds issue soon

jacobyxu commented 6 years ago

Hi Adam,

I have done finally, it works in Firefox perfectly. I will test it more later. link, please have a look.

Updates:

feature firefox chrome
hover info work work
multiple plot work work
separate click work work
special shape work not
AdamSpannbauer commented 6 years ago

Seems to be working great on my end! Good stuff @JacobXPX

AdamSpannbauer commented 6 years ago

I think the work @JacobXPX fixes the reasons I had for opening this issue. I'm going to close it.