Skip to content

TypeError: Cannot read property 'filter' of undefined in johnson.js #40

@architawr

Description

@architawr

I use d3@5. Use this example https://bl.ocks.org/tomshanley/a434d47dc7ff983c764ccc555e89e295

import * as d3Sankey from 'd3-sankey-circular';

const sankey = d3Sankey
        .sankeyCircular()
        .nodeId(d => d.name)
        .nodeAlign(d3Sankey.sankeyJustify)
        .nodeWidth(12)
        .nodePadding(15)
        .nodePaddingRatio(0.5)
        .iterations(32)
        .size([width, height])

const sankeyData = sankey(data);

data

{
  nodes: [
   {name: 'new'},
   {name: 'confirmed'},
   ....
 ],
 links: [
   {target: 'new', source: 'confirmed', value: 10},
   .....
 ]  
}

And sankeyData not generated, but throw the error
image
johnson.js
image

And if i change nodeId to d => d.index (instead d => d.name) this error disappears and another appears
image

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions