Hello all,
I have a problem when use shiny to render plot, here is the simple code:
This is part of ui.R:
ui = fluidPage(
selectInput("selectValue", label = "Select: ", choices = c(A, B, C), selected = A)),
uiOutput("dateRange")
plotOutput(outputId = "plot")
)
This is part of server.R:
server = function(input, output) {
output$dateRange = renderUI({
start = myTimeFunction(input$selectValue)
end = myTimeFunction(input$selectValue)
dateRangeInput("dateRange", label = "Date Range:", start = start, end = end)
})
output$plot = renderPlot({
plot = myRenderFunction(input$selectValue, input$dateRange[1], input$dateRange[2])
})
}
as you see:
output$dateRange depends on input$selvetValue,
output$plot denpends on both input$selectVlaue and input$dateRang
when I change the selectValue in UI , the plot will render twice
first render plot uses the old date range(Wrong)
second render plot uses the right date range
Can anyone help me to solve this problem to render plot only once when change selectValue
Any help would be hugely appreciated!