score:1

Maybe it helps if you put your D3 code inside this, to ensure that the DOM is fully rendered/ loaded before executing D3 specific code.

document.addEventListener("DOMContentLoaded", function(event) { 
  //do d3 stuff here
});

If you are using jQuery, you can use this:

$( document ).ready(function() {
    //do d3 stuff here
});

Related Query

More Query from same tag