我有一个使用shinydashboard
制作的R Shiny应用程序,但是在使UI填充浏览器窗口时遇到了问题。
这是我的ui.R输出:
#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
## app.R ##
library(rsconnect)
library(shinydashboardPlus)
library(shinydashboard)
library(shiny)
#shinyApp(ui = ui, server = server, options = list(height = 1080))
ui <- dashboardPage(skin = "red",
dashboardHeader(title = "Miradashboard",
# This drop-down menu offers user and system administration within the application
dropdownMenu(type = "messages",
messageItem(
from = "Sales Dept",
message = "Sales are steady this month."
),
messageItem(
from = "New User",
message = "How do I register?",
icon = icon("question"),
time = "13:45"
),
messageItem(
from = "Support",
message = "The new server is ready.",
icon = icon("life-ring"),
time = "2014-12-01"
)
),
# This is a drop-down menu for checking notifications.
# This should alert users of alerts that have not been merged to a case in the last 15 days.
dropdownMenu(type = "notifications",
notificationItem(
text = "5 new users today",
icon("users")
),
notificationItem(
text = "12 items delivered",
icon("truck"),
status = "success"
),
notificationItem(
text = "Server load at 86%",
icon = icon("exclamation-triangle"),
status = "warning"
)
),
# This is a drop-down menu for checking tasks.
# This drop-down menu will eventually offer suggestions based off of ML Algorithms.
dropdownMenu(type = "tasks", badgeStatus = "success",
taskItem(value = 90, color = "green",
"Documentation"
),
taskItem(value = 17, color = "aqua",
"Project X"
),
taskItem(value = 75, color = "yellow",
"Server deployment"
),
taskItem(value = 80, color = "red",
"Overall project"
)
)
),
dashboardSidebar(
## Sidebar content
dashboardSidebar(
sidebarMenu(
menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
menuItem("Widgets", tabName = "widgets", icon = icon("th")),
menuItem("Reports", tabName = "reports", icon = icon("th")),
menuItem("OpsCare Clients", tabName = "OpsCare Clients", icon = icon("bar-chart-o")),
menuItem("ProdCare Clients", tabName = "ProdCare Clients", icon = icon("bar-chart-o")),
menuItem("Alerts", tabName = "Alerts", icon = icon("bar-chart-o")),
menuItem("Change Requests", tabName = "Change Requests", icon = icon("list-alt")),
menuItem("Maintenance Windows", tabName = "Maintenance Windows", icon = icon("list-alt")),
menuItem("Rundeck", tabName = "Rundeck", icon = icon("bars")),
menuItem("Salesforce", tabName = "Salesforce", icon = icon("bars")),
menuItem("Handovers", tabName = "Handovers", icon = icon("bars")),
menuItem("Jump-Host Access", tabName = "Jump-Host Access", icon = icon("bars"))
)
)
),
dashboardBody(
# Boxes need to be put in a row (or column)
fluidRow(
box(plotOutput("plot1", height = 250)),
box(plotOutput("plot2", height = 250)),
box(plotOutput("plot3", height = 250)),
#box(plotOutput("plot4", height = 250)),
#box(dataTableOutput("DT1", height = 250)),
box(
title = "Controls",
sliderInput("slider", "Number of observations:", 1, 100, 50)
)
)
)
)
server <- function(input, output) {
set.seed(122)
histdata <- rnorm(500)
# List Server Output whereby plot[1-#] is the plot box output in UI above.
# Server Output occurds and is defined by data variables
# histdata[seq_len(input$slider)] defines slider utilization
# hist(data) defines histogram off of "data"te
output$plot1 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
output$plot2 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
output$plot3 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
output$plot4 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
output$plot5 <- renderPlot({
data <- histdata[seq_len(input$slider)]
hist(data)
})
}
shinyApp(ui, server)
正如您在附件中看到的图片所示,该页面正在Web浏览器中被剪切。我的最终目标是将其扩展到全屏,因为我试图使内部用户可以使用和访问它。如果有人对如何将仪表板页面扩展到完整大小有任何建议,那将是不错的选择。
就尝试自己解决问题而言,我研究了以下方面以将其扩展到全屏显示。
答案 0 :(得分:0)
我运行您的代码,它全屏显示。这里是我的shinyapp.io account上的应用。
也许您必须检查应用程序版本。这是我的软件包版本。我正在使用R版本3.5.2(2018-12-20)和RStudio 1.1.463。
R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
other attached packages:
[1] shinydashboard_0.7.1 shinydashboardPlus_0.6.0 rsconnect_0.8.12
[4] shiny_1.2.0 forcats_0.3.0 stringr_1.3.1
[7] dplyr_0.7.5 purrr_0.2.4 readr_1.1.1
[10] tidyr_0.8.1 tibble_1.4.2 ggplot2_3.0.0
[13] tidyverse_1.2.1
loaded via a namespace (and not attached):
[1] tidyselect_0.2.4 reshape2_1.4.3 haven_1.1.1 lattice_0.20-38
[5] colorspace_1.3-2 htmltools_0.3.6 yaml_2.2.0 utf8_1.1.4
[9] rlang_0.2.0 pillar_1.2.3 later_0.7.5 foreign_0.8-71
[13] glue_1.3.0 withr_2.1.2 modelr_0.1.2 readxl_1.1.0
[17] bindrcpp_0.2.2 bindr_0.1.1 plyr_1.8.4 munsell_0.4.3
[21] gtable_0.2.0 cellranger_1.1.0 rvest_0.3.2 psych_1.8.4
[25] httpuv_1.4.5.1 parallel_3.5.2 broom_0.4.4 Rcpp_1.0.0
[29] xtable_1.8-2 openssl_1.0.1 promises_1.0.1 scales_0.5.0
[33] jsonlite_1.6 mime_0.5 mnormt_1.5-5 hms_0.4.2
[37] digest_0.6.18 stringi_1.1.7 grid_3.5.2 cli_1.0.0
[41] tools_3.5.2 magrittr_1.5 lazyeval_0.2.1 crayon_1.3.4
[45] pkgconfig_2.0.1 xml2_1.2.0 lubridate_1.7.4 assertthat_0.2.0
[49] httr_1.3.1 rstudioapi_0.7 R6_2.2.2 nlme_3.1-137
[53] compiler_3.5.2
我还尝试了RStudio中的“在窗口中运行”,它也可以全屏显示。