I want to be able to let users see different heatmaps based on a parameter\'s choice in shiny, using rCharts and Leaflet.
The first time the heatmap is displayed it
The answer to my problem has been given brilliantly by paulyeno.
This piece of javascript substitute the lines above:
tags$body(tags$script(HTML(sprintf("
var addressPoints = %s
if (typeof heat === typeof undefined) {
heat = L.heatLayer(addressPoints, {maxZoom: 9, radius: 20, blur: 40})
heat.addTo(map)
} else {
heat.setOptions({maxZoom: 9, radius: 20, blur: 40})
heat.setLatLngs(addressPoints)
}
</script>", jsdat
Please note that currently the above code runs in shiny 0.10.1 but not in 0.10.2.1 (bug reported to shiny & rCharts)