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

How to use events? #20

Open
cho7tom opened this issue Mar 7, 2015 · 8 comments
Open

How to use events? #20

cho7tom opened this issue Mar 7, 2015 · 8 comments

Comments

@cho7tom
Copy link

cho7tom commented Mar 7, 2015

Dear Joe,

First of all congratulation for your great package!
I have built a map with circle markers and popups, and I would like popups to appear when the mouse goes on a circle. I am not a js user, and I don't understand how I should use the events (if it's the correct concept to be invoked here) in my R code.
Could you please help me with this issue?
Thank you in advance and best regards,
Thomas

my code:
output$mapTweets <- renderLeaflet({
m = leaflet() %>% addTiles()
m
m %>% addCircleMarkers(lng = located_patient.tw$lon, lat = located_patient.tw$lat, popup = custom.popup, radius = 4, opacity = 0.2)
})
}

@jcheng5
Copy link
Owner

jcheng5 commented Mar 11, 2015

It looks like you're actually talking about the new version of the package, available at https://github.com/rstudio/leaflet. The functionality you're looking for isn't natural to do yet, but we're looking to add it pretty soon.

However it's quite straightforward to do with the older version of the package available at this repo. Look in this example: https://github.com/jcheng5/leaflet-shiny/blob/master/inst/examples/population/server.R#L102

@basttran
Copy link

Hi Joe,

I do agree with cho7tom: this is a fantastic package. I also would like to use the older version of leaflet and I believe you forgot to provide the corresponding repo.

Also (I don't know if it is the right place to say that - if not I do apologize) the example at http://glimmer.rstudio.com/jcheng/leaflet-demo/ seems based on the older version and doesn't fully reflect the sources at https://github.com/jcheng5/leaflet-shiny/tree/master/inst/examples/population.
For instance there is currently no "Add marker on click" checkboxInput declared in ui.R. On a broader level I can't find anything related to adding popups in said sources.
Quite likely the example is based on the old version while the code on Github is meant to comply with the current version state.
Unless I got confused all by myself (could be the case - it happens more often than it should) this is a bit misleading.

In any case: still fantastic. Thanks!

Best regards,
Bastien

EDIT: Ok, I see hinkelman already posted about this (issue #12) and that the example actually matches the code at https://github.com/jcheng5/leaflet-shiny/tree/polygon-example/inst/example, so don't mind me ;)

@lifan0127
Copy link

In the population example, it is possible to remove existing markers (via map$clearMarker()). Is this function possible with the new rstudio/leaflet version? Thanks!

@jcheng5
Copy link
Owner

jcheng5 commented Apr 3, 2015

In the population example, it is possible to remove existing markers (via map$clearMarker()). Is this function possible with the new rstudio/leaflet version? Thanks!

Not yet, but we're intending to bring that functionality in over the coming weeks.

@lifan0127
Copy link

Thanks! Look forward to seeing this functionality in rstudio/leaflet!

@tgirgin23
Copy link

When using renderPrint to output what is contained in "event", I get my latitude and longitude (and another column named "nonce" which is a value that ranges from 0 to 1 apparently) but no ID. How can I have an ID for each circleMarker that is displayed?

Thank you!

@jcheng5
Copy link
Owner

jcheng5 commented Apr 14, 2015 via email

@tgirgin23
Copy link

Thank you Joe!

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

5 participants