第二个Leaflet addCircleMarkers调用中断了串扰链接

问题描述

我正在处理链接传单和d3scatter图的多变量数据。它适用于一个变量。如果我尝试通过第二个addCircleMarkers和addLayersControl在Leaflet中包含第二个变量,则sharedData链接会中断,过滤不起作用,刷涂也不起作用。提前致谢。 附有MWE:

library("crosstalk")
library("d3scatter")
library("leaflet")

Long <- c(117.4,117.5,117.6)
Lat<- c(-33.7,-33.8,-33.9)
var1 <- c(21,22,23)
var2 <- c(31,32,33)
species <- c(8,9,10)

df1<- data.frame(Long,Lat,var1,var2,species)
sdf1 <- SharedData$new(df1)

col_1 <- c( "yellow","black","orange")
col_2 <- c("red","green","blue")


l <- leaflet(sdf1)%>% 
  setView(117.5,10) %>% 
  addCircleMarkers(radius = 1,color = col_1,group = "1") %>%
#  addCircleMarkers(radius = 1,color =  col_2,group = "2") %>%
# PROBLEM  -  adding the second "addCircleMarkers" enables the overlayGroups but 
#             it breaks the link between the plots and breaks the filter
  addLayersControl(overlayGroups=c("1","2"))


m <- list(l,filter_checkBox("unique_id_for_species","Animal Species",sdf1,~species))
n <- list(d3scatter(sdf1,~var2,~var1,color = ~species,x_lim = c(30,40),y_lim = c(20,25),width="70%",height=200),d3scatter(sdf1,y_lim = c(30,x_lim = c(20,height=200))

bscols(m,n)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)