A am playing with arrows in leaflet
in R
and i found function addFlows
in leaflet.minicharts
library. It is exacly what I need, but I have problem to plot correct information on popup
which we get after clicking on each arrow.
As you can see on the picture, on popup
should be PL to DE: 5
, unfortunately on all arrows we have PL to LT
, it doesn't work dynamically. Is it possible to correct description? as correct I mean so that the values that make up the description come from the same line as the geographic coordinates and the value for drawing a particular arrow
Code which i used to generate pic:
flowArrows <- data.frame(
out_lng = c(19, 19, 19),
out_lat = c(52, 52, 52),
out_iso = c("PL", "PL", "PL"),
in_lng = c(23, 15, 10),
in_lat = c(55, 49, 52),
in_iso = c("LT", "CZ", "DE"),
value = c(1, 3, 5)
)
leaflet() %>%
addProviderTiles(providers$Esri.WorldGrayCanvas) %>%
setView(lng = 17.03097722271075, lat = 51.11043372425852, zoom = 5) %>%
addFlows(
flowArrows$out_lng,
flowArrows$out_lat,
flowArrows$in_lng,
flowArrows$in_lat,
flow = flowArrows$value,
popup = popupArgs(labels = paste0(flowArrows$out_iso, " to ", flowArrows$in_iso)),
color = "#FF0000"
)