Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crosstalk::filter_checkbox does not work when leaflet has more than one addCircles layer. #835

Open
riemerra opened this issue Dec 18, 2022 · 0 comments

Comments

@riemerra
Copy link

Issue #745 provided a patch for an earlier version of leaflet which did not work when modified and applied to leaflet_2.1.1.tar.gz\leaflet\inst\htmlwidgets\leaflet.js

Minimal example provided below.

library(crosstalk)
library(leaflet)

tstd = data.frame(lng=-116.3013+rnorm(10)/100,lat=33.1005+rnorm(10)/100,
           Levels=c("L","L","L","L","L","H","H","H","H","H"))

sd_tstd <- crosstalk::SharedData$new(tstd)

crosstalk::filter_checkbox("Levels", "Levels", sd_tstd, ~Levels, inline = T)
leaflet(sd_tstd) %>% addTiles() %>% setView(-116.3013, 33.1005, zoom=13) %>%
  addCircles(lng=~lng, lat=~lat, radius=99, stroke=T, weight=1, color="black", opacity=1, fill=F, group = "No Fill" ) %>% 
  addCircles(lng=~lng, lat=~lat, radius=99, stroke=T, weight=1, color="black", fill=T, fillColor="blue" , opacity=1, group = "With Fill") %>% 
  addLayersControl(baseGroups=c('No Fill', 'With Fill'),options = layersControlOptions(collapsed=F))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant