2

我正在尝试减小 dygraph 输出的大小。但是我的所有设置似乎都被忽略了。

我尝试在仪表板布局和 dygraph 设置中指定高度。所有软件包和软件都是通过 github 而不是 CRAN 更新的。

在此处输入图像描述

这是我在下面尝试过的。

我在下面按 DOM 层次顺序列出了我的代码,以帮助您理解。

shinyUI(dashboardPage(header, sidebar, body))

body <- dashboardBody(
  tabItems(
    ...
    tabItem(tabName = "comments_explorer_tab", tab_comment),
    ...
    )
  )

tab_comment <-  fluidPage(
  titlePanel("Data Explorer")
  column(
      ...
      width = 2 # reduce width of sidebar
  ),
  column(
      width = 10,
      fluidRow(height='50px',
        tabsetPanel(
          tabPanel("Time", height=50, dygraphs::dygraphOutput("comment_dygraph")))
      ),
      fluidRow(DTOutput("data_table"))   
  ) 
)

shinyServer(function(input, output) {

output$comment_dygraph <- renderDygraph({
       
        dygraph(comment_counts, height=50,  main = paste0("Daily Counts for "user")) %>%
            dyOptions(colors = RColorBrewer::brewer.pal(3, "Dark2"), includeZero = TRUE, retainDateWindow = TRUE) %>%
            dyAxis("x", drawGrid = FALSE) %>%
            dyAxis("y", label = "Counts")
    })

output$data_table <- renderDT({
        datatable(data = comment_time_selection(),
                  extensions = c("Scroller"),
                  options = list(
                      autoWidth = TRUE,
                      scrollResize =TRUE,
                      scrollX = TRUE,
                      scrollCollapse= TRUE,
                      scrollY = 100,
                      initComplete = I('function(setting, json) { alert("done"); }')
                      ),
                  rownames= FALSE
                  )  
    })
}

在此处输入图像描述

4

0 回答 0