2

I am trying to decrease the size of my dygraph output. But all of my settings seem to be ignored.

I have tried specifying the height in both the dashboard layout and dygraph settings. All packages and software is up-to-date via github not CRAN.

enter image description here

Here is what I have tried below.

I have listed my code below in DOM hierarchical order to assist with your understanding.

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
                  )  
    })
}

enter image description here

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Gabriel Fair
  • 4,081
  • 5
  • 33
  • 54
  • Try `dygraphOutput("comment_dygraph", height=400, width=600)` – YBS Jan 27 '21 at 19:22
  • That fixed it! There seems to be a bug where `height` is ignored unless I also specify a `width`. I was able to use: `dygraphOutput("comment_dygraph", height=200, width='100%')` – Gabriel Fair Jan 27 '21 at 20:25

0 Answers0