topogram_proxy_iteration: Update number of iteration with proxy

Description Usage Arguments Value Examples

View source: R/shiny.R

Description

Use this in 'shiny' application to update an already generated topogram().

Usage

1
topogram_proxy_iteration(proxy, n_iteration)

Arguments

proxy

A topogram_proxy htmlwidget object.

n_iteration

Number of iterations to run the algorithm for. Higher numbers distorts the areas closer to their associated value, at the cost of performance.

Value

A topogram_proxy htmlwidget object.

Examples

 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
library(topogram)
library(shiny)

ui <- fluidPage(
  tags$h2("Update number of iteration with proxy"),
  sliderInput(
    inputId = "n_iteration", 
    label = "Number of iteration (more takes longer)",
    min = 1, 
    max = 60,
    value = 10
  ),
  topogramOutput(outputId = "ID", height = "800px")
)

server <- function(input, output, session) {
  
  # Initialize the topogram (non reactive)
  output$ID <- renderTopogram({
    topogram(
      sfobj = world,
      value = "pop_est", 
      label = "{name} : {value}"
    )
  })
  
  # Update with proxy
  observeEvent(input$n_iteration, {
    topogram_proxy_iteration("ID", input$n_iteration)
  }, ignoreInit = TRUE)
  
}

if (interactive())
  shinyApp(ui, server)

dreamRs/topogRam documentation built on Dec. 16, 2021, 6:47 p.m.