下面的脚本在R闪亮仪表板页面的两个框内创建了两个图,这些图对齐到框的右侧,我希望对齐这些框的中心。这些包是创建给定图的最小必需包。请帮忙。
## app.R ##
library(shiny)
library(shinydashboard)
library(bupaR)
library(edeaR)
library(eventdataR)
library(processmapR)
library(processmonitR)
library(xesreadR)
library(petrinetR)
ui <- dashboardPage(
dashboardHeader(
),
dashboardSidebar(
width = 0
),
dashboardBody(
box(title = "Process Map", status = "primary",height = "575", solidHeader =
T,patients %>% process_map(),align = "left"),
box(title = "Resource Map", status = "primary",height = "575", solidHeader =
T,
resource_map(patients, render = T))
)
)
server <- function(input, output) { }
shinyApp(ui, server)
答案 0 :(得分:4)
问题似乎是htmlwidgets初始化为960像素宽度左右。两种覆盖方法可能是:
pmap <- patients %>% process_map()
pmap$width <- "100%"
rmap <- resource_map(patients, render = T)
rmap$width <- "100%"
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
width = 0
),
dashboardBody(
box(
title = "Process Map",
status = "primary",height = "575",
solidHeader = T,
pmap,
align = "left"),
box(
title = "Resource Map",
status = "primary",
height = "575",
solidHeader = T,
rmap
)
)
)
或
ui <- dashboardPage(
dashboardHeader(),
dashboardSidebar(
width = 0
),
dashboardBody(
tags$head(tags$style(HTML(".grViz { width:100%!important;}"))),
box(
title = "Process Map",
status = "primary",height = "575",
solidHeader = T,
patients %>% process_map(),
align = "left"),
box(
title = "Resource Map",
status = "primary",
height = "575",
solidHeader = T,
resource_map(patients, render = T)
)
)
)