leaflet.minichart icon indicating copy to clipboard operation
leaflet.minichart copied to clipboard

Charts don't go away when overlay is deactivated in L.control.layers

Open fiendish opened this issue 6 years ago • 4 comments

If you have a layer control, deactivating any charts layer never actually hides them like it should.

I had to add this to make it work (I have all my charts in an L.layerGroup):

function hide_charts(e) {
   e.layer.eachLayer(
      function(t) {
         if (t._chart) { t._chart.remove(); }
      }
   );
}
map.on('overlayremove', hide_charts)
 

fiendish avatar Dec 29 '17 05:12 fiendish