## Proxies

gior comes with numerous proxies. Shiny proxies let you interact with a visualisation without having to redraw it everytime you do so.

For examples, you can change the dataset on the fly without having to redraw the entire globe.

library(shiny)

data("country_data")

ui <- fluidPage(
actionButton("clear", "clear"),
uiOutput("sw"),
giorOutput("gior")
)

server <- function(input, output, session){

output$sw <- renderUI({ selectInput("selectCountry", "Switch Country", choices = unique(country_data$from))
})

observeEvent(input$selectCountry, { giorProxy("gior") %>% g_switch_p(input$selectCountry)
})

output$gior <- renderGior({ country_data %>% gior() %>% g_data(from, to, value) }) observeEvent(input$clear, {
giorProxy("gior") %>%
g_clear_p()
})

shinyApp(ui, server)