popover/tooltip 的 R 闪亮值框
R Shiny valueBox with popover/tooltip
我尝试从 shinydashboard 为 valueBox 创建一个 popover/tooltip,但到目前为止没有任何效果。
我尝试使用 shinyBS,例如 popify 函数,但后来我收到错误警告:tagAssert 中的错误:需要一个带有 class 'shiny.tag'.
的对象
当我使用 addTooltip 或 addPopover 函数时,我没有收到任何错误,但是当我将鼠标悬停在 valueBox 上时什么也没有出现。还有更多建议吗?
library(shinydashboard)
library(shinyBS)
ui <- dashboardPage(
dashboardHeader(title = 'Title', disable = TRUE),
dashboardSidebar(),
dashboardBody(
valueBoxOutput("TestBox", width = NULL)))
server <- function(input, output, session) {
output$TestBox <- renderValueBox({
popify(
valueBox(
value = "50 %",
subtitle = "Test",
color = "black")
, title = "TestTitle", content = "TestContent", placement = "bottom", trigger = "hower", options = NULL)
})
# addPopover(session, id = "TestBox", title = "TestTitle", content = "TestContent", placement = "bottom", trigger = "hover", options = NULL)
}
shinyApp(ui = ui, server = server)
您可以使用 bsTooltip
向 Shiny 输入或输出添加工具提示:
这是一个基于您提供的内容的最小示例:
library(shinydashboard)
library(shinyBS)
ui <- dashboardPage(
dashboardHeader(title = 'Title', disable = TRUE),
dashboardSidebar(),
dashboardBody(
valueBoxOutput("TestBox", width = 10),
bsTooltip("TestBox", "you can choose whatever you want",
"bottom", ),
)
)
server <- function(input, output, session) {
output$TestBox <- renderValueBox({
valueBox( value = "50 %",
subtitle="Test",
color = "black")
})
}
当您将鼠标悬停在框上时,您会看到工具提示出现在框的底部。
我建议你查看 this
我尝试从 shinydashboard 为 valueBox 创建一个 popover/tooltip,但到目前为止没有任何效果。
我尝试使用 shinyBS,例如 popify 函数,但后来我收到错误警告:tagAssert 中的错误:需要一个带有 class 'shiny.tag'.
的对象当我使用 addTooltip 或 addPopover 函数时,我没有收到任何错误,但是当我将鼠标悬停在 valueBox 上时什么也没有出现。还有更多建议吗?
library(shinydashboard) library(shinyBS) ui <- dashboardPage( dashboardHeader(title = 'Title', disable = TRUE), dashboardSidebar(), dashboardBody( valueBoxOutput("TestBox", width = NULL))) server <- function(input, output, session) { output$TestBox <- renderValueBox({ popify( valueBox( value = "50 %", subtitle = "Test", color = "black") , title = "TestTitle", content = "TestContent", placement = "bottom", trigger = "hower", options = NULL) }) # addPopover(session, id = "TestBox", title = "TestTitle", content = "TestContent", placement = "bottom", trigger = "hover", options = NULL) } shinyApp(ui = ui, server = server)
您可以使用 bsTooltip
向 Shiny 输入或输出添加工具提示:
这是一个基于您提供的内容的最小示例:
library(shinydashboard)
library(shinyBS)
ui <- dashboardPage(
dashboardHeader(title = 'Title', disable = TRUE),
dashboardSidebar(),
dashboardBody(
valueBoxOutput("TestBox", width = 10),
bsTooltip("TestBox", "you can choose whatever you want",
"bottom", ),
)
)
server <- function(input, output, session) {
output$TestBox <- renderValueBox({
valueBox( value = "50 %",
subtitle="Test",
color = "black")
})
}
当您将鼠标悬停在框上时,您会看到工具提示出现在框的底部。
我建议你查看 this