我想在infoBox中添加一个信息圈作为actionButton,通过点击它我们可以看到一个定义。这是我的代码,我想要显示ratio
的def:
library(shiny)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"))
)
),
dashboardBody(
tabItems(
# First tab content
tabItem(tabName = "dashboard",
fluidRow(
infoBoxOutput("ratio")
)
))))
server <- function(input, output) {
output$ratio = renderInfoBox({
infoBox("ratio",10*2, icon = icon("users"))
})
}
shinyApp(ui, server)
就像在这张照片中一样:
我只有这一个:
答案 0 :(得分:0)
如果我理解正确,您想用信息框中的信息图标替换用户图标?这可以通过在icon()函数中用信息替换用户来完成。
==> D:\bat\SO\10558316.bat
--- file content
this line is 100% valid! Sure! Hurrah!
--- enabled delayed expansion chokes down unescaped exclamation marks! "!"
loop var=this line is 100% valid Hurrah
_auxLine=this line is 100% valid Hurrah
--- toggled delayed expansion works although might be laborious!
loop var=this line is 100% valid! Sure! Hurrah!
_auxLine=this line is 100% valid! Sure! Hurrah!
--- keep delayed expansion DISABLED: use CALL command!
loop var=this line is 100% valid! Sure! Hurrah!
_auxLine=this line is 100% valid! Sure! Hurrah!
WARNING: !_auxLine! as well as %G loop variables are not available here!
==>
Shiny使用Font Awesome图标库,因此您可以在website上找到其他图标。
答案 1 :(得分:0)
我确实找到了一个解决方案,但我并不满意:这是输出的代码和图像(我无法将信息图标移动到我的框的右上方并且没有#&# 39; t喜欢消息的形式)enter image description here
library(shiny)
library(shinyjs)
library(shinydashboard)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"))
)
),
dashboardBody(useShinyjs(),
tabItems(
# First tab content
tabItem(tabName = "dashboard",
fluidRow(
infoBoxOutput("ratio")
)
))))
server <- function(input, output) {
output$ratio = renderInfoBox({
infoBox("ratio",10*2, icon = icon("users"),
subtitle = HTML("<a id=\"button\" href=\"#\" class=\"action-button\">
<i class=\"fa fa-info-circle\"></i>
</a>"))
})
observeEvent(input$button, {
shinyjs::info("definition")
})
}
shinyApp(ui, server)