Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
480 views
in Technique[技术] by (71.8m points)

shinydashboard - Unable to change size of dygraphs in Shiny

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

question from:https://stackoverflow.com/questions/65920006/unable-to-change-size-of-dygraphs-in-shiny

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.7k users

...