Appsilon / shiny.semantic

Shiny support for powerful Fomantic UI library.
http://appsilon.github.io/shiny.semantic
Other
497 stars 96 forks source link

[Bug]: Plots doesn't resize inside grids #441

Closed serkor1 closed 3 months ago

serkor1 commented 1 year ago

Guidelines

Project Version

No response

Platform and OS Version

Ubuntu 20.04

Existing Issues

No response

What happened?

If you include a plot in a grid-area, the plot doesn't adjust in size properly except when specifying cols_width as percentages. It does increase in size, but it doesn't decrease.

Steps to reproduce


# gc
rm(list = ls()); invisible(gc())

# library
library(shiny.semantic)
library(shiny)

# basic app;
ui <- semanticPage(

  column(
    width = 12,
    grid(
      grid_template = grid_template(
        default = list(
          areas = rbind(
            c('first')
          ),
          cols_width  = c('1fr'),
          rows_height = c('auto') 
        )
      ),
      first = tableOutput(
        'table'
      )
    ),

    grid(
      grid_template = grid_template(
        default = list(
          areas = rbind(
            c('first')
          ),
          cols_width  = c('1fr'),
          rows_height = c('auto') 
        )
      ),
      first = plotOutput(
        'plot',width = '100%'
      )
    )
  )
)

server <- function(input, output, session) {

  output$table <- renderTable(
    {
      head(
        mtcars
      )
    },
    width = '100%'
  )

  output$plot <- renderPlot(
    {
     plot(
       x = 1:100,
       y = 1:100
     )
    }
  )

}

shinyApp(ui, server)

Expected behavior

The plot should conform to the size of the grid-area, similar to the table but it doesn't.

Attachments

No response

Screenshots or Videos

No response

Additional Information

No response

serkor1 commented 1 year ago

If the widths are defined as vw or %, then there is no issue - its strictly related to fr.