How to execute code after a d3.js svg is fully loaded?

Viewed 133

I use an external library that uses d3 to print a bubble chart. I am coding in Angular. I want to override the onmouseover event of one the sub-components within the bubble chart. If I type this in the console it works:

d3.selectAll('.class1 > text').on("mouseover", function(){alert("Hello");});

Unfortunately I do not know whether there is any event in d3 that fires when the d3 chart is fully loaded (i.e., that the bubble chart and all its sub-components are already printed within the DOM). In particular, when I write such code in the ngOnInit() function, the components are not still in the DOM (i.e., they are undefined), and thus, the alerts do not pop up.

I am looking for some kind of afterDraw() event or something in d3. Any idea so I can include such code in the component.ts file?

0 Answers
Related