Search code examples
javascriptd3.jsvisualizationsankey-diagram

Sankey D3.js sankey.link is not a function


I'm new to JS/D3.js (so thanks in advance for any support). I'm trying to create a basic sankey diagram using Gerardo's d3.v5 fork https://bl.ocks.org/GerardoFurtado/ff2096ed1aa29bb74fa151a39e9c1387 however when I try to run the same script I'm getting the error:

"Uncaught TypeError: sankey.link is not a function"

What am I missing? Looking through the latest version of d3-sankey I cannot see the function, is this from a previous version of d3-sankey? Whats the alternative now if that is the case?


Solution

  • MB's v0.5.0 update to D3-sankey replaces the use of the sankey.link with d3.sankeyLinkHorizontal. Due to splitting out the script from the original HTML when copying this in to my text editor, it began calling the latest version that doesn't have the function.

    After copying in the whole html code into a single file its working.