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

Support link.id. #31

Closed
mbostock opened this issue Jun 12, 2017 · 0 comments
Closed

Support link.id. #31

mbostock opened this issue Jun 12, 2017 · 0 comments

Comments

@mbostock
Copy link
Member

mbostock commented Jun 12, 2017

Like from d3-force, link.id. It would allow you to specify an accessor function that computes a unique string identifier for a given node; that function would then be applied to each input node, then joined with the source and target of each input link to compute the graph.

For example, if you said:

sankey.nodeId(d => d.name);

You could then give as input:

{
  "nodes": [
    {"name": "A"},
    {"name": "B"},
    {"name": "C"}
  ],
  "links": [
    {"source": "A", "target": "B", "value": 1},
    {"source": "A", "target": "C", "value": 2},
    {"source": "B", "target": "C", "value": 3}
  ]
}
antoinerg pushed a commit to plotly/d3-sankey that referenced this issue Jan 29, 2019
antoinerg pushed a commit to plotly/d3-sankey that referenced this issue Jan 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant