What works is, that the sessions communicate with each other. But the problem, that remains is, that if i push F5 or start a new browser-window (a new session), all Dashboards get set back to the default value.
library(shiny)
# Define UI for application that draws a histogram
ui <- fluidPage(
# Application title
titlePanel("Old Faithful Geyser Data"),
# Sidebar with a slider input for 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")
)
)
)
# Define server logic required to draw a histogram
server <- function(input, output){
if(!exists("RV", envir = .GlobalEnv)){
RV <<- reactiveValues(bins = 10)
}
observe({
RV$bins <<- input$bins
})
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = RV$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white', main = paste(RV$bins, "bins"))
})
}
# Run the application
shinyApp(ui = ui, server = server)
i think i have to make the UI use the global value first. I guess i need reactive UI-element for that?
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = RV$bins)