Thanks a lot for your answer,
I post here my code because I would like to try to implement leafletProxy. I really want to know how to use it.
I have different filter to apply on my map.
Here the peace of code that I have and I try to implement leaflet can you help me??
quintiles = unique(quantile(df_mapa$Tx_weight, probs = (0:5)/5,na.rm = T))
pal_mortalidade <- colorBin("YlOrRd", domain = df_mapa$Tx_weight, bins = quintiles)
labels <- sprintf(
"<strong>%s</strong><br/>%g Taxa </sup>",
df_mapa$UF,df_mapa$Tx_weight) %>% lapply(htmltools::HTML)
mortalidade <- leaflet(df_mapa, options = leafletOptions(minZoom = 3,zoomSnap = 0.1,zoomDelta =
0.1) ) %>% addTiles() %>% addPolygons(
fillColor = ~pal_mortalidade(df_mapa$Tx_weight),
weight = 0.5,
opacity = 1,
color = "white",
dashArray = "3",
fillOpacity = 0.7,
label = labels,
layerId = ~UF,
highlightOptions = highlightOptions(color = "black", weight = 2,
bringToFront = TRUE)) %>%
addResetMapButton() %>% addLegend(pal = pal_mortalidade, values = ~variavel, opacity = 0.7,
title = NULL,position = "bottomright")%>%
onRender(
"function(el, x) {
L.easyPrint({
sizeModes: ['Current', 'A4Landscape', 'A4Portrait'],
filename: 'mymap',
exportOnly: true,
hideControlContainer: false
}).addTo(this);
}"
)
output$plot_mapa_mortalidade <- renderLeaflet({
mortalidade
})
observeEvent(mortalidade, {
leafletProxy("plot_mapa_mortalidade", data = mortalidade) %>%
setShapeStyle(layerId = ~estado_cod, fillColor=~pal_mortalidade$Tx_weight, color = white)
})
before this code i Upload in my project the file on the github page:
https://github.com/rstudio/leaflet/issues/496, with the jvascript function.
But still dosn't work,
I'm wondering if there is a solution without using javascript and only leafletprxy.
Thanks in advanceThis text will be hidden