我想在我 Shiny 的仪表板应用程序中更改背景。我在互联网功能 setBackgroundImage ( https://rdrr.io/cran/shinyWidgets/man/setBackgroundImage.html ) 中受伤。问题是我不知道我是否应该将该功能放在我的应用程序中。例如是经典应用程序,而不是仪表板。
library(shiny)
library(shinydashboard)
library(shinyWidgets)
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(),
dashboardBody(
setBackgroundImage(src = "http://wallpics4k.com/wp-content/uploads/2014/07/470318.jpg")
)
)
server <- function(input, output) {}
shinyApp(ui, server)
也可以将传单 map 作为背景吗?
最佳答案
你可以用 tags$img()
来做,并将位置属性指定为绝对。注意 img 标签必须放在 dashboardBody
中的第一个位置:
...
dashboardBody(
tags$img(
src = "http://wallpics4k.com/wp-content/uploads/2014/07/470318.jpg",
style = 'position: absolute'
),
...
)
...
它还接受
width
和 height
参数。您还可以使用 hspace
定位您的图像和 vspace
参数。
关于r - 图片作为 Shiny 仪表板的背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54568428/