我想在闪亮的仪表板应用程序中更改背景。我使用了互联网功能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)
还可以将传单地图作为背景吗?
答案 0 :(得分:1)
您可以使用function arrayCounter($data){
//At this point we have an array or an object.
//Lets loop across the elements and see if we have any more nested arrays or objects.
foreach($data as $key){
$count = 0;
//Test each element to see if it's an object or an array.
if(is_array($key) || is_object($key)){
//If it is we are going to send the element through another instance of the function.
$count += arrayCounter($key);
}
//If the element is an array we are going to increment the counter.
if(is_array($key)){
$count++;
}
}
return $count;
}
$count = arrayCounter($data);
echo 'Count: ' . $count; //Using your data this will return "2".
并将其位置属性指定为绝对值。请注意,必须将img标签放置在tags$img()
中的第一位置:
dashboardBody
它也接受...
dashboardBody(
tags$img(
src = "http://wallpics4k.com/wp-content/uploads/2014/07/470318.jpg",
style = 'position: absolute'
),
...
)
...
和width
参数。您还可以使用height
和hspace
参数定位图像。