leaflet.minichart
leaflet.minichart copied to clipboard
Charts don't go away when overlay is deactivated in L.control.layers
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)