Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic example on wiki does work - crashes with TypeError: Cannot read properties of undefined (reading 'length') #33

Open
bnovc opened this issue May 11, 2023 · 2 comments

Comments

@bnovc
Copy link

bnovc commented May 11, 2023

Using the basic example on https://ricklupton.github.io/d3-sankey-diagram/, I get the following:

-sankey-diagram.umd.js:20584 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
at titlePosition (d3-sankey-diagram.umd.js:20584:1)
at HTMLUnknownElement.eval (d3-sankey-diagram.umd.js:20467:1)
at Selection.eval [as each] (each.js:5:1)
at sankeyNode (d3-sankey-diagram.umd.js:20458:1)
at Selection.eval [as call] (call.js:4:1)
at updateNodes (d3-sankey-diagram.umd.js:20744:1)
at HTMLDivElement.eval (d3-sankey-diagram.umd.js:20711:1)
at Wn.each (d3.min.js:2:25626)
at exports (d3-sankey-diagram.umd.js:20674:1)
at Wn.call (d3.min.js:2:25196)
t

0.8.0 d3-sankey-diagram
7.8.4 d3

@ricklupton
Copy link
Owner

Hi @bnovc, can you be more specific about the code you are running to see this error? e.g. a simple self-contained example that illustrates the problem? Thanks

@nouman91
Copy link

nouman91 commented Sep 7, 2023

@ricklupton I have been wrestling with similar issues for the past day and a half. Here is the simple setup:

  const sankeydata = {
      nodes: [
        { name: "Barry" },
        { name: "Frodo" },
        { name: "Elvis" },
        { name: "Sarah" },
        { name: "Alice" },
      ],
      links: [
        { source: 0, target: 2, value: 2 },
        { source: 1, target: 2, value: 2 },
        { source: 1, target: 3, value: 2 },
        { source: 0, target: 4, value: 2 },
        { source: 2, target: 3, value: 2 },
        { source: 2, target: 4, value: 2 },
        { source: 3, target: 4, value: 4 },
      ],
  };

var layout = sankey()
          .extent([[20, 10], [width - 20, height - 10]]);
var diagram = sankeyDiagram()
svg.datum(layout(sankeydata)).call(diagram)

Here is the error that I get:

ndle.js:8724 Uncaught TypeError: Cannot read properties of undefined (reading 'length')
    at titlePosition (d3-sankey-diagram.umd.js:20571:18)
    at SVGGElement.eval (d3-sankey-diagram.umd.js:20454:24)
    at Selection.__WEBPACK_DEFAULT_EXPORT__ [as each] (each.js:9:37)
    at sankeyNode (d3-sankey-diagram.umd.js:20445:15)
    at Selection.__WEBPACK_DEFAULT_EXPORT__ [as call] (call.js:8:12)
    at updateNodes (d3-sankey-diagram.umd.js:20724:10)
    at SVGSVGElement.eval (d3-sankey-diagram.umd.js:20698:7)
 

I have simple code setup with webpack dev server, nothing too fancy. But I can't seem to figure out why is this happening. So far I have tried with different data sets but nothing works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants