I created a map on the CartoDB website with multiple layers, each with its own legend. I now wish to use CartoDB.js to be able to toggle between the layers, so the legend will toggle on with the corresponding layer.
I used cartodb.createVis() to load the map and its layers. I'm able to show and hide layers using layer.show() and layer.hide(), but the legend(s) shown are those for the visible layer(s) on the CartoDB website version of the map.
Could you please tell me how to toggle the legend to correspond with the visible CartoDB.js layer.
أكثر...
I used cartodb.createVis() to load the map and its layers. I'm able to show and hide layers using layer.show() and layer.hide(), but the legend(s) shown are those for the visible layer(s) on the CartoDB website version of the map.
Could you please tell me how to toggle the legend to correspond with the visible CartoDB.js layer.
أكثر...