Ash*_*aul 5 r shiny shinydashboard
下面的脚本在 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)
Run Code Online (Sandbox Code Playgroud)
问题似乎是 htmlwidget 被初始化为 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
)
)
)
Run Code Online (Sandbox Code Playgroud)
或者
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)
)
)
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6277 次 |
| 最近记录: |