我想用 Wordcloud 制作一个闪亮的应用程序。但是当鼠标悬停在单词上时,我在更改结果时遇到了问题。我想要的是,当用户的鼠标悬停在单词上时,它会变为指针。
根据here和here的答案,我试图将它放在某种css类中(实际上并不知道我做了什么)
#in the body ui
(tags$head(tags$style(HTML('div#wcLabel {cursor: pointer;}')))
但它没有用。
这是一个可重现的示例
library(shiny)
library(wordcloud2)
# Global variables can go here
n <- 1
# Define the UI
ui <- bootstrapPage(tags$head(
tags$style(HTML('div#wcLabel {cursor: pointer;}'))
),
numericInput('size', 'Size of wordcloud', n),
wordcloud2Output('wordcloud2')
)
# Define the server code
server <- function(input, output) {
output$wordcloud2 <- renderWordcloud2({
# wordcloud2(demoFreqC, size=input$size)
wordcloud2(demoFreq, size=input$size)
})
}
# Return a Shiny app object
shinyApp(ui = ui, server = server)
我知道函数中有一个调用hoverFunction =
,wordcloud2()
我想我必须在其中放一些东西才能实现我的目标,但我不知道是什么。
任何帮助将非常感激。非常感谢!
弗雷德里克