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

Sankey chart - Not able to control display order of nodes #9820

Closed
1 of 7 tasks
spime-web opened this issue Jan 22, 2019 · 2 comments
Closed
1 of 7 tasks

Sankey chart - Not able to control display order of nodes #9820

spime-web opened this issue Jan 22, 2019 · 2 comments

Comments

@spime-web
Copy link

spime-web commented Jan 22, 2019

General Questions

Issue Type

  • I have a question to ask about how to use ECharts to ...;我想提问如何使用 ECharts 实现某功能
  • I have a bug to report;我想要报 bug
  • I have a feature to request, e.g.: I'd like a new feature that ...;我需要一个新功能
  • I have a feature to enhance, e.g.: The current feature should be improved in the way that ...;我希望改进某个功能
  • There's something wrong with the documents;文档有些问题
  • Others, or I'm not sure which issue types to choose here;其他,或我不知道应该选什么类型

Issue Details

As per the #4986, order of the nodes displayed in the Sankey chart will be based on the series.data. But the latest version (4.2.0) doesn't work as expected.

Expected Behavior

When below option is specified for Sankey charts, the order of nodes should be AAAAAAA, CCCCCCC and DDDDDD.

var data = [{"name":"AAAAAAA","value":7},
              {"name":"CCCCCCC","value":6},
              {"name":"DDDDDD","value":5},
              {"name":"EEEEEE","value":4},
              {"name":"FFFFFF","value":3},
              {"name":"BBBBBB","value":2}];
var links = [
			{"source":"DDDDDD","target":"EEEEEE","value":1},
			{"source":"CCCCCCC","target":"FFFFFF","value":1},
			{"source":"AAAAAAA","target":"BBBBBB","value":1},
            {"source":"AAAAAAA","target":"EEEEEE","value":1}]
  
myChart.setOption(option = {
    title: {
        text: 'Sankey Diagram'
    },
    tooltip: {
        trigger: 'item',
        triggerOn: 'mousemove'
    },
    series: [
        {
            type: 'sankey',
            data: data,
            links: links,
            focusNodeAdjacency: 'allEdges',
            itemStyle: {
                normal: {
                    borderWidth: 1,
                    borderColor: '#aaa'
                }
            },
            lineStyle: {
                normal: {
                    color: 'source',
                    curveness: 0.5
                }
            }
        }
    ]
});

Current Behavior

But the nodes are in different order as shown in the below image:

sankey-chart-actual

Online Example

Go to https://ecomfe.github.io/echarts-examples/public/editor.html?c=sankey-energy and replace the left panel code with the code snippet provided in the "Expected behavior" section and click Run.

Topics

Anything Else We Need to Know

A similar issue has been reported earlier (#4986) but as that issue has been closed, I am creating a this issue.

Environment

  • ECharts version;ECharts 版本: {DESCRIBE_HERE}

  • It happens only on certain browsers or operating systems. 对于特定浏览器或操作系统才会出现的问题,请提供相应环境信息:{BROWSER_VERSION_OR_OS_INFORMATION_HERE}

@100pah 100pah added the pending We are not sure about whether this is a bug/new feature. label Jan 22, 2019
@spime-web
Copy link
Author

Hi,

It would be great if you could provide some rough idea on when the fix would be available.

Thanks & Regards,
Bala

@deqingli deqingli added this to the 4.7.0 milestone Nov 7, 2019
@deqingli
Copy link
Member

Hi,

It would be great if you could provide some rough idea on when the fix would be available.

Thanks & Regards,
Bala

Hi @spime-web, you can set layoutIterations = 0.

@Ovilia Ovilia removed this from the 4.7.0 milestone Feb 21, 2020
@Ovilia Ovilia added support and removed pending We are not sure about whether this is a bug/new feature. labels Feb 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants