Open uwesterr opened 4 years ago
reason for double plots was that
The input updater functions send a message to the client, telling it to change the settings of an input object. The messages are collected and sent after all the observers (including outputs) have finished running. could be solved by adding sliderUpdate to
rkiAndPredictData <- reactive({
and adding###### set values according to optimized values ############ RkiDataWithR0N0 <- r0_no_erfasstDf() %>% unnest(data) OptResultDf <- RkiDataWithR0N0[[1,"optimizedInput"]] isolate(inputForOptimization <- input) # to make setting reduzierung_rtx easy and fast
for (inputVarName in OptResultDf[[1]] %>% names) {
print("for (inputVarName in OptResultDf[[1]] %>% names) {")
if (inputVarName %in% (isolate(inputForOptimization %>% names))) {
if (inputVarName %in% (str_subset(isolate(inputForOptimization %>% names), "reduzierung"))) {
(updateSliderInput(session, inputVarName, value = OptResultDf[[1]][[inputVarName]]))
} else {
(updateNumericInput(session, inputVarName, value = round(OptResultDf[[1]][[inputVarName]],1)))
}
}
}
### set input values since update function send data only after plots are generated
#browser()
OptResultDf <- RkiDataWithR0N0[[1,"optimizedInput"]]
inputForOptimization <- isolate(reactiveValuesToList(input)) # to make setting reduzierung_rtx easy and fast
for (inputVarName in OptResultDf[[1]] %>% names) {
if (inputVarName %in% (inputForOptimization %>% names)) {
inputForOptimization[[inputVarName]]<- OptResultDf[[1]][[inputVarName]]
}
}
fixed in commit https://github.com/uwesterr/CoronaPredict/commit/0c50af234a6a27baa30ef1bdbe36ee3b0310d7fe
tools to help profvis({runApp()})
which shows that most time is spend in ggplotly
um das doppelte aufrufen zu eliminieren hilft das tool reactlog https://rstudio.github.io/reactlog/?_ga=2.128972495.2110847215.1589012676-10469058.1589012676
move libraries to optimizingChain.R find reason why plots are always created twice