refactor: moved d3 code into conditional code injection to allow loading H$ on a server without errors