You can select all the elements below the SVG with the "svg > *" selector, i.e. to remove all of those, do
d3.selectAll("svg > *").remove();
You can select all the elements below the SVG with the "svg > *" selector, i.e. to remove all of those, do
d3.selectAll("svg > *").remove();