Closed
Description
First of all many thanks for the grouped layer/legend feature. This really is a game changer as it makes interacting with the map much cleaner. I found a little bug related to NA value rendering in the legend.
If we use the new group
argument in addLegend
and the data has NAs I see that the na.color
part of the legend gets repeatedly added to the legend as the layer is switched on/off.
library(leaflet)
library(mapview)
library(sf)
breweries = st_join(breweries, franconia[, "district"])
pal = colorFactor(c("red", "purple", "blue"),
domain = mapview::breweries$district,
na.color = "#BEBEBE")
leaflet() %>%
addTiles() %>%
addCircleMarkers(data = breweries, color = ~pal(district), group = "breweries") %>%
addLayersControl(overlayGroups = "breweries") %>%
addLegend(pal = pal, values = breweries$district, group = "breweries")
In the primary rendering of the legend everything looks as expected. If we switch the breweries
layer off and on we get a second NA
entry in the legend. This is repeatedly added every time we switch the layer off/on.
Metadata
Metadata
Assignees
Labels
No labels