Accepted answer

You've two questions in one here, one is about versions of the d3.sankey.js and one is about not rendering.

Not Rendering

I'm surprised it crashes your browser, but I'm not surprised that you get the console errors. It looks like the available space you've given to the Sankey is not enough for all the Nodes/Links so some of them are being given negative heights.

These are what cause the console errors, increasing the overall height of your chart (even if it's not all visible at once) should fix the console errors. As for the crashing the tab you probably need to hit pause a few times and see if it's stuck in a loop somewhere. My guess is that because the Sankey has some pretty intensive layout algorithms to run, it could just be spending a long time in there.


The only reliable way I know of you use two different versions is to functionally scope them. Normally you do this by way of some modular pattern (e.g. using import "d3" and then webpacking. This would allow you to produce different bundles for you charts requiring different versions of d3.

Related Query

More Query from same tag