繁体   English   中英

在R闪亮的仪表板中将图形对齐到框的中心()

[英]Aligning plots to the center of the box() in R shiny dashboard

下面的脚本在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)

在此输入图像描述

问题似乎是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)
    )
  )
)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM