在我的闪亮应用程序中,我有一个日期范围输入和一组复选框。复选框的选择取决于输入$ dateRange。每当日期范围发生变化时,我都会遇到一个问题,即该绘图正在重绘两次。第一次重新绘制它将使用新的日期范围,但是旧的复选框选项。然后更新复选框选项并再次绘制该图。如何防止每个UI交互重绘多次闪亮阴影?
是否有任何方法可以防止重绘多次,只有在所有其他UI元素更新后才能绘制它?
server.R代码片断
# Check boxes for variants in run
output$choose_variants <- renderUI({
# Get the variants associated with the run
dat <- loadVariants(input$dateRange[1], input$dateRange[2])
if(is.null(dat))
return()
# Create the checkboxes and select them all by default
checkboxGroupInput("variants", "Variants",
choices = dat$variant,
selected = dat$variant)
})
# Output the data
output$plot1 <- renderPlot({
runLocations <- loadRunsBetweenDates(input$dateRange[1], input$dateRange[2], input$variants)
#ggplot()
})
ui.R代码片段
sidebarPanel(
dateRangeInput('dateRange',
label = 'Date range',
start = Sys.Date(), end = Sys.Date()
),
uiOutput("choose_variants")
),
弗洛里安是比我快: ('isolate()'是要走的路! –