block by timelyportfolio 2e4ccebc16e30f94596cb38aff27e673

R leaflet popups with sparkline htmlwidget

Full Screen

See DT issue

library(leaflet)

m = leaflet() %>% addTiles()

# popup
rand_lng = function(n = 10) rnorm(n, -93.65, .01)
rand_lat = function(n = 10) rnorm(n, 42.0285, .01)

# use automatic bounds derived from lng/lat data
m = m %>% clearBounds()

# popup
m %>% addPopups(
  rand_lng(),
  rand_lat(),
  lapply(1:10, function(x){
    as.character(sparkline(runif(10)))
  })
) %>%
  onRender(
"
function(el,x) {HTMLWidgets.staticRender()}
"
  ) %>%
  add_deps("sparkline", "sparkline") %>%
  browsable()