Comments (5)
Hi Andrzej, I can't repro this behavior. Can you gist the entire modified ui.R file that demonstrates the problem? Or if you prefer, you can e-mail it to me at joe AT rstudio DOT org.
Thanks!
from shiny.
OK, I looked at the files you e-mailed me and the bug here is for plots that have "auto" width and/or height (the default) and are not visible at the time the page loads. If you switch to the Plots tab and resize the window you will see the plot snap into place. The problem here is the plot's size is 0x0 at the time the page loads, and we only update the plot size when the window size changes, not when switching tabs.
Good bug! We will fix this before release. In the meantime the only easy way I can think of to work around the bug is to set the width and height of the plot explicitly (i.e. pass width= and height= to reactivePlot).
from shiny.
Fixed in Shiny 0.1.3. Thanks!
from shiny.
Thank you Joe,
Two qs, if I may
- In 02_text example we choose one data set from a list (rock, pressure,
cars).
Then in the second step (I) would like to choose one variable from a
list specific for selected data.
In other words second choice/selection depends on the first. Is it
possible (without html file)? - In 06_tabsets example I tried to replace radioButtons() with a set of
tabPanels() and maintain similar functionality. "dist" value is being
updated as needed, but plot in the main panel is not (always normal). ui.R
is included below.
Thank you in advance
A.
library(shiny)
Define UI for random distribution application
shinyUI(pageWithSidebar(
Application title
headerPanel("Tabsets"),
Sidebar with controls to select the random distribution type
and number of observations to generate. Note the use of the br()
element to introduce extra vertical spacing
sidebarPanel(
tabsetPanel(
tabPanel("Normal", textInput("dist","Xdist1", c("norm"))),
tabPanel("Uniform", textInput("dist","Xdist2", c("unif"))),
tabPanel("Log-normal", textInput("dist","Xdist3", c("lnorm"))),
tabPanel("Exponential", textInput("dist","Xdist4", c("exp")))
),
br(),
sliderInput("n",
"Number of observations:",
value = 500,
min = 1,
max = 1000)
),
Show a tabset that includes a plot, summary, and table view
of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Plot", plotOutput("plot")),
tabPanel("Table", tableOutput("table"))
)
)
))
On Mon, Aug 20, 2012 at 6:02 PM, Joe Cheng [email protected] wrote:
Fixed in Shiny 0.1.3. Thanks!
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/10#issuecomment-7885127.
from shiny.
I made a couple of tweaks to your code that should give you what you want.
library(shiny)
# Define UI for random distribution application
shinyUI(pageWithSidebar(
# Application title
headerPanel("Tabsets"),
# Sidebar with controls to select the random distribution type
# and number of observations to generate. Note the use of the br()
# element to introduce extra vertical spacing
sidebarPanel(
tabsetPanel(id='dist',
tabPanel("Normal", value='norm', textInput("dist1","Xdist1", c("norm"))),
tabPanel("Uniform", value='unif', textInput("dist2","Xdist2", c("unif"))),
tabPanel("Log-normal", value='lnorm', textInput("dist3","Xdist3", c("lnorm"))),
tabPanel("Exponential", value='exp', textInput("dist4","Xdist4", c("exp")))
),
br(),
sliderInput("n",
"Number of observations:",
value = 500,
min = 1,
max = 1000)
),
# Show a tabset that includes a plot, summary, and table view
# of the generated distribution
mainPanel(
tabsetPanel(
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Plot", plotOutput("plot")),
tabPanel("Table", tableOutput("table"))
)
)
))
First, notice that tabsetPanel
now has an id
, and the tabPanel
calls under it now have values. If you want the currently selected tab to take the place of the radio buttons in the original example, this is how you do it. Then inside the tab, you can put whatever you want (I'm guessing not the textboxes you had in your example).
One other thing to note about your code was that you had four textInput
s with the same value for id
. Even if they are on different tabs, all IDs in a page must be unique or else the results will be undefined--i.e. even if they work as you want them to in Shiny 0.1.3, they could break at any time. Hopefully though, this limitation should be easy to work around--if not, please let me know.
Thanks!
from shiny.
Related Issues (20)
- Update input - HTML in label
- After upgrading to R 4.3.3 and Shiny 1.8.0 on ubuntu, I am not able to run shiny. Error in is.call(funBody[[idx]]) && as.character(funBody[[idx]][[1]]) == : 'length = 3' in coercion to 'logical(1)' HOT 2
- Error message text color is too subtle with Bootstrap 5
- Error with a htmlwidget HOT 2
- reactlog doesn't work with latest shiny
- `shinyDeprecated()` should probably `warn()`, not `inform()` HOT 1
- After upgrading to Shiny 1.8.1 from 1.8.0, no data is visible on my shiny APP HOT 23
- Shiny app shows a blank page when re-opened with `rstudioapi::viewer()` HOT 2
- Output of ModuleServer doesn't always update using numericInput
- Shiny 1.8.1 seems to break reactivity between my linked modules HOT 4
- JavaScript error dialog header is hidden when using {shinydashboard}
- Example for ExtendedTask HOT 3
- Bookmarking a frozen input throws an error
- With Bootstrap 5, `uiOutput()` doesn't dim in opacity when recalculating
- Plot overlaps onto tab panel. HOT 2
- shiny > 1.8.0 breaks tags$button reactivity HOT 2
- Set outputOtions at assignment
- Long running Shiny app starts printing lots of "nothing to compact" messages HOT 1
- Allow `OnUnhandledError` to be scoped to modules
- Warning: Error in ggplot2::geom_boxplot: Problem while converting geom to grob.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shiny.