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

Add property to define size of a node in Sankey Chart #11644

Closed
peterviergutz opened this issue Nov 14, 2019 · 5 comments
Closed

Add property to define size of a node in Sankey Chart #11644

peterviergutz opened this issue Nov 14, 2019 · 5 comments
Assignees
Labels
en This issue is in English new-feature topic: sankey

Comments

@peterviergutz
Copy link

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);
  });
}
@echarts-bot
Copy link

echarts-bot bot commented Nov 14, 2019

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.

If you are interested in the project, you may also subscribe our mail list.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Nov 14, 2019
@deqingli deqingli removed pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Nov 14, 2019
@deqingli deqingli self-assigned this Nov 14, 2019
@deqingli
Copy link
Member

deqingli commented Nov 14, 2019

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
}]

@peterviergutz
Copy link
Author

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.

@ChibahAbdelwahab
Copy link

ChibahAbdelwahab commented Dec 8, 2019

Hi,
I'm actually in the same case, have this been added ?

@deqingli deqingli added this to the 4.8.0 milestone Jan 14, 2020
@deqingli
Copy link
Member

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.

deqingli added a commit that referenced this issue Jan 14, 2020
@Ovilia Ovilia removed this from the 4.8.0 milestone Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English new-feature topic: sankey
Projects
None yet
Development

No branches or pull requests

4 participants