I have built a shiny app which produces a plot with a map after selecting an input date,
it works fine, the problem is that when zooming in or out the browser screen the app recalculates the map, instead of just zooming what is already plotted,
is there a way to prevent this re-calculation?
the code is something like
ui <- fluidPage(
titlePanel("A map"),
sidebarLayout(
sidebarPanel(
dateInput("date", "Date: ",value = some_date,min = min_date,max = max_date),
),
mainPanel(
plotOutput(outputId = "map_xx",height = 1000),
)
)
server <- function(input, output, session) {
krig <- reactive({
filename <- paste0('mapname',input$date)
read_grid(filename)
})
output$map_xx <- renderPlot({
map_rmax(krig(),input$date)
})
}
basically the reactive part reads a grid file whose name depends on the selected date then the function map_rmax plots the map
any ideas? thanks a lot in advance, Ramón
What do you mean by zooming the browser ?
I'm not sure if it's a good idea for the renderPlot to take dependency on both krig() and input$date as krig() already depends on input$date Feels like it will fire renderPlot two times each time input$date value is changed.
Anyway I would try to track input$date maybe through an observeEvent with str(input$date) in it just to see when it's updated when zooming on the plot.