-
Notifications
You must be signed in to change notification settings - Fork 56
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
linking between leaflet and d3scatter not working #47
Comments
Your source is really mangled. Is there a clean version online somewhere to try? |
@dmurdoch `---
|
That's got the same problem: Github is treating the chunk boundaries etc. as markup. You'll need to put the file online somewhere else and link to it. |
@dmurdoch The previous link wasn't working - this one should work. |
I took a look at your example. I think the issue is unrelated to Maybe you could simplify the example to only include a filter slider and some spatial polygons displayed in |
First of all, Secondly, in your example, leaflet(sd_df) %>%
addPolygons(data = world_NA, color = "#969696", weight = 1, fillColor = "#808080") %>%
addPolygons(data = world, color = "#969696", weight = 2, fillColor = ~pal(continent), fillOpacity = 0.8, label = ~as.character(country)) you're passing |
That change didn't fix things for me. If I use the CRAN version of leaflet (1.1.0), it gives an error:
If I update to the Github version of leaflet (rstudio/leaflet, 1.1.0.9000, 2017-02-17) the error goes away, but the map is unresponsive to changes to the other controls. |
The original - posted here: seems to work as it should - I had to change to the SharedData() to get it to work at all when I tried it. I wonder if that is blocking something....? @dmurdoch - here is a shortened version with just sliders, for testing... https://gist.github.com/Myles12345/7f60bf44722d3ec5e555bbb968e9fa74 |
This is kind of weird. The rpubs.com example isn't using the leaflet package from CRAN or the current master branch on github. You can see this if you debug it: the Javascript for leaflet on that page has crosstalk code in the methods.addPolygons function, whereas the mainstream ones don't. I don't know Henry Partridge (@rcatlord); if you do, maybe you could contact him to ask about it. But the reason yours doesn't work is because you aren't using this customized version of leaflet. |
Okay, adding crosstalk support to |
That's amazing - I found that it was crosstalk4 that seemed to be the relevant branch? I also (as you noted) removed - Here is a working version: Thank you so much for your support and fantastic work! |
Yes, |
I've been using this package version to filter polygons and its worked perfectly, however I noticed that polygons are now not filtering again. I reinstalled the leaflet version using Thanks |
I figured out the problem. For anyone working on a Dell laptop with OneDrive, I would recommend saving the library folder in the c drive instead of the OneDrive location. After changing the location of my packages and re-downloading the leaflet version it is now working. |
Generally speaking R and R packages shouldn't care about where they are stored, but it is easy to have several versions of a package in different library locations, and then sometimes a little surprising which one R chooses. So I would recommend checking that you really only have one copy of each package installed, or this problem might arise again. |
Hi all - I've updated the code for the gapminder / crosstalk app. It takes into the workarounds mentioned here and the code is more concise. |
Hi, |
@JacobBraslaw22: The issue you're commenting on was posted 4 years ago. I don't know about the others, but I've long forgotten the context. Could you post a new issue, with minimal reproducible code in it? |
@dmurdoch I'm having the same problem as @JacobBraslaw22. I'm trying to replicate creating the following app (http://rpubs.com/rcatlord/gapminder_crosstalk_updated). The source code works for leaflet version 1.1.0.9000 but not for the leaflet version 2.1. It seems like crosstalk4 doesn't work for addPolygons- the filter_slide works as it should for everything else (plots & map with addMarker). Do you have a workaround this? Thank you! |
@hmeeks: No, I haven't looked at that code in 4 years. |
@hmeeks have you opened an issue on rstudio/leaflet repository ? |
Firstly, my apologies if this is an error on my part. I have been trying to work with the example provided on
http://rstudio-pubs-static.s3.amazonaws.com/209203_02f14fea3274448bbbf8d04c99c6051b.html
There seems to be some oddities with this code (perhaps it is older?) - the sd$transform(as.data.frame) does not seem to work as is. I created work around using:
sd_df <- SharedData$new(world@data, group = sd$groupName())
This may be the culprit or not. When I amend the code on the site above - and run. I am able to get linking between DT and d3scatter but not with leaflet map, as the version above shows. It seems like the SharedData is not being respected when used with leaflet?
Can others re-create the issue that I am experiencing? Does the native code posted on the website work for others? Again - if this is an oversight on my part I apologize
The code I am using is (knitted to flexdashboard:
`---
title: "Gapminder data using crosstalk"
output:
flexdashboard::flex_dashboard:
orientation: rows
theme: lumen
Inputs {.sidebar}
This R Markdown document uses the experimental crosstalk R package to enable interactivity between different widgets that display the same Gapminder data.
Credits:
The following packages were used: flexdashboard, rgdal, dplyr, leaflet, d3scatter, DT, gapminder, countrycode,
rworldmap, and spatialEco.
Row {data-height=550}
Row {data-height=450}
The text was updated successfully, but these errors were encountered: