bs4Dash icon indicating copy to clipboard operation
bs4Dash copied to clipboard

Maximize = TRUE does not resize wordcloud2 plot

Open FreyGeospatial opened this issue 3 years ago • 0 comments

I am having a couple problems..

  1. Maximize does not resize plots from wordcloud2 package. I have reproduced this below
  2. Maximize toggle resizes plots here for both plotly and base::hist function, but only on clicking the screen after pressing toggle button, and only the width is adjusted (does not become full-screen). Is there a way for maximize to be automatic on toggle, without that second click, and for the the resize (including hieght) to span the entire screen?
  3. Maximize toggle resizes plot width for plotly in this example, but not on my larger project, which I cannot reproduce here, unfortunately T_T
library(shiny)
library(bs4Dash)
library(plotly)
library(wordcloud2) # I use the development version, at https://github.com/Lchiffon/wordcloud2 as the CRAN version has been interfering with bs4Dash on other projects
library(ggplot2)
library(magrittr)

shinyApp(
  ui = dashboardPage(
    header = dashboardHeader(
      title = dashboardBrand(
        title = "My dashboard",
        color = "primary",
        href = "https://adminlte.io/themes/v3",
        image = "https://adminlte.io/themes/v3/dist/img/AdminLTELogo.png"
      )
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(
      fluidRow(
        column(4, box(id = "wordcloud_box", width = 12, title = "Testing", wordcloud2Output("cloud"), maximizable = TRUE)),
         column(4, box(id = "plotly_box", width = 12, title = "testing", plotlyOutput("bar"), maximizable = TRUE)),
        column(4, box(id = "reg_box", width = 12, title = "blah", plotOutput("hist"), maximizable = TRUE))

      )
    ),
    controlbar = dashboardControlbar(),
    title = "DashboardPage"
  ),
  server = function(input, output) {

    output$cloud <- renderWordcloud2({data.frame(word=LETTERS, count = sample.int(30, 26)) %>% wordcloud2::wordcloud2(minRotation = 1.5708,
                                                                                                                   maxRotation = 1.5708,
                                                                                                                   rotateRatio = 0.33,
                                                                                                                   gridSize = 20)})

    output$bar <- renderPlotly({
      ggplotly(ggplot(data.frame(word=LETTERS, count = sample.int(30, 26)), aes(x = word, y = count))+
                 geom_bar(stat = "identity")+
                 # mdthemes::md_theme_classic()+
                 ggtitle("My Plot")+
                 xlab("Dates")+
                 ylab("Frequency of Dates Referenced"), dynamicTicks = T, tooltip = "text") %>%
        rangeslider()
    })


    output$hist <- renderPlot(hist(airquality$Temp))

    #########

  }
)

FreyGeospatial avatar Dec 13 '21 21:12 FreyGeospatial