Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plots on boxes are not re-rendered when hiding/showing the sidebar #62

Closed
Gaasmann opened this issue Jun 30, 2015 · 9 comments
Closed
Assignees

Comments

@Gaasmann
Copy link

Gaasmann commented Jun 30, 2015

Hello,

I have a little dashboard displaying some ggplot2 graphs. When I modify the size of my browser, the body is recalculated and redrawn correclty.
But when I hide the sidebar with the button on the header, the boxes are re-sized but not the graphs themselves. The result is a well sized and drawn boxes with too small graph aligned to the left of each box.
The code for the body is the following:

bodyLayout <- function() {
 bl <- dashboardBody(
 tabItems(
 tabItem(tabName = "tab1",
 fluidRow(
 h2(" status"),
 renderVPbox("item1", item1_level),
 renderVPbox("item2", item2_level)),
 fluidRow(
 renderVPbox("item3", item3_level),
 renderVPbox("item4", item4_level))
 ),
 tabItem(tabName = "statistics",
 h2("Statistics"),
 fluidRow(
 box(plotOutput("stat_ass_reg_month")),
 box(plotOutput("stat_ass_reg_week"),width=6),
 box(plotOutput("stat_ass_reg_day"),width=6),
 box(plotOutput("stat_team_month"),width=6),
 box(plotOutput("stat_team_month_ppt"),width=6),
 box(plotOutput("stat_team_week"),width=6),
 box(plotOutput("stat_team_day"),width=6)
 )
 )
 )
 )
}

Do you have an idea to fix this?

Thanks,

Nicolas

@MarkDB001
Copy link

I have the same issue would be nice to have a fix for this.

@maxmoro
Copy link

maxmoro commented Aug 14, 2015

Same here.. thanks

@aquacalc
Copy link

Same issue. Yet to find a work-around.

Is there a way to observe the sidebar show/hide event, and then code a re-draw of the plot?

@zhiboz
Copy link

zhiboz commented Oct 19, 2016

It puzzled me quite a while until I found this issue report and got to know that I am not alone. Any workaround yet? A fix from the code base would be even better! Thanks!

@bborgesr
Copy link
Contributor

@wch: I think that in order to fix this, we need to do a $("window").trigger("resize") when the sidebar is collapsed (detected by the body having class sidebar-collapse). This means that this gets triggered.

I tried adding $("window").trigger("resize") after each of these lines (app.js#332 and app.js#334), but that didn't work...

@jpark711
Copy link

jpark711 commented May 10, 2017

I am having a same problem. If this issue was closed because it had been fixed, please advise me of the solution.

@bborgesr
Copy link
Contributor

Are you using the Github/development version of shinydashboard, installed with:

devtools::install_github("rstudio/shinydashboard")

If so, that really shouldn't be happening. Can you provide a repro?


If you're using the CRAN version of shinydashboard installed with (install.packages("shinydashboard")), you need to switch over to the devel version, because we've got yet released this fix (it's coming in the next couple of weeks).

@aquacalc
Copy link

This (temporary?) fix worked for me:

http://stackoverflow.com/questions/36655640/shiny-dashboard-does-not-scale-well

@jpark711
Copy link

I have installed Shiny Dashboard by
install.packages('shinydashboard')
With some extra search, I found a solution from the same thread as the one @aquacalc mentioned.
As the development version that @bborgesr revised in the past includes an identical line, I understand that it will work as well. Thank you both for prompt replies!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants