Это мой ui.R
. Это пример, приведенный в учебнике Shiny. Я только что отредактировал его.
library(shiny)
library(markdown)
# Define UI for application that draws a histogram
shinyUI(fluidPage(
# Application title
titlePanel("Hello Shiny!"),
# Sidebar with a slider input for the number of bins
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
absolutePanel(
bottom = 0, left=420, width = 800,
draggable = TRUE,
wellPanel(
em("This panel can be moved")
)
)
))
))
и мой server. R
library(shiny)
# Define server logic required to draw a histogram
shinyServer(function(input, output) {
# Expression that generates a histogram. The expression is
# wrapped in a call to renderPlot to indicate that:
#
# 1) It is "reactive" and therefore should be automatically
# re-executed when inputs change
# 2) Its output type is a plot
output$distPlot <- renderPlot({
x <- faithful[, 2] # Old Faithful Geyser data
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})**
В этом случае sliderInput не работает. Если я удалю абсолютную панель, sliderInput в порядке. В чем может быть проблема?
Большое спасибо
draggable = FALSE
в вызовеabsolutePanel
решает проблему с ползунком, но очевидно, что они должны сосуществовать. Это также работает, если вы переместите ползунок вabsolutePanel
, поэтому я полагаю, что текущая проблема, скорее всего, просто ошибка, которую нужно исправить. Вы можете изменить заголовок своего вопроса, чтобы отразить это, или сообщить о нем как об ошибке на сайте github: https://github.com/rstudio/shiny/issues - person theEricStone   schedule 29.04.2014