I attempted to upgrade this d3 visualization from version 3 to version 5, but instead of updating within the existing visualization, it continues to add another visualization below. I included:
d3.select(".node").selectAll("*").remove();
d3.select(".link").selectAll("*").remove();
to try and remove the most recent visualization when updating, however, it's not achieving the desired effect. Can anyone explain why this method is not working?
For reference, you can access the code here.