Description Usage Arguments Examples
Dynamically update arcs with Shiny.
1 2 3 4 | update_arcs(proxy, origin.lon, origin.lat, destination.lon, destination.lat,
...)
update_arcs_name(proxy, origin, destination, ...)
|
proxy |
a proxy as returned by |
origin.lon |
origin coordinates. |
origin.lat |
origin coordinates. |
destination.lon |
destination coordinates. |
destination.lat |
destination coordinates. |
... |
any other arguments to use as options. |
origin |
edges. |
destination |
edges. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | ## Not run:
library(shiny)
ui <- fluidPage(
textInput(
"from",
"Origin",
value = "USA"
),
textInput(
"to",
"Destination",
value = "RUS"
),
actionButton(
"submit",
"Draw arc"
),
datamapsOutput("map")
)
server <- function(input, output){
arc <- reactive({
data.frame(from = input$from, to = input$to)
})
output$map <- renderDatamaps({
datamaps()
})
observeEvent(input$submit, {
datamapsProxy("map") %>%
add_data(arc()) %>%
update_arcs_name(from, to)
})
}
shinyApp(ui, server)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.