question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add property to define size of a node in Sankey Chart

See original GitHub issue

What problem does this feature solve?

In the current implementation the node size in a Sankey chart is determined by the bigger number of incoming or outgoing edges. Our case involves a node size that is actually bigger than the connections between the nodes:

expected

What does the proposed API look like?

An optional new property size on the nodes’ properties could offer a clean option to define the node’s size

{
  "nodes": [
    {
      "name": "a1",
      "size": 100
    }
...

To get the node’s size in the chart could then be determined by whatever is bigger: the sum of incoming and outgoing edges or the node’s defined size in

https://github.com/apache/incubator-echarts/blob/fcfa95012ca561becab607b065a62b5f87220801/src/chart/sankey/sankeyLayout.js#L86


function computeNodeValues(nodes) {
  zrUtil.each(nodes, function (node) {
    var value1 = sum(node.outEdges, getEdgeValue);
    var value2 = sum(node.inEdges, getEdgeValue);
    var value = Math.max(value1, value2, node.size); // <-- node.size here
    node.setLayout({
      value: value
    }, true);
  });
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
deqinglicommented, Jan 13, 2020

Maybe I can add new property value of each node, to keep consistent with graph series.

nodes: [{
    name: 'aaa',
    value: 100, // the same effect as size
    depth: 3
}]
0reactions
deqinglicommented, Jan 14, 2020

I agree value would have been the right name in the first place. Thanks for your consideration.

PS I guess just a typo, but 100 should be an integer.

Yeah, it is an integer, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add property to define size of a node in Sankey Chart
What problem does this feature solve? In the current implementation the node size in a Sankey chart is determined by the bigger number...
Read more >
Sankey Diagram
Sankey Diagram is a type of flow diagram that depicts the flow of resources from one node to another. ... You can set...
Read more >
Vizlib Sankey Chart - Data and Data Handling
Vizlib Sankey Chart supports one measure with multiple dimensions. In the Data section, you can add dimensions or metrics dynamically and ...
Read more >
Sankey Diagram | Charts
A sankey diagram is a visualization used to depict a flow from one set of values to another. The things being connected are...
Read more >
Dynamically change width of d3.js sankey chart
So user clicks node, chart shrinks to half it's width, and I can append content into the new space... Thing is, the d3...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found