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

使用DagreLayout布局时,nodes数组中节点的顺序会导致连线交叉 #2816

Closed
appleqzw opened this issue Nov 1, 2022 · 4 comments

Comments

@appleqzw
Copy link

appleqzw commented Nov 1, 2022

问题描述

使用DagreLayout布局,nodes数组中节点的顺序,会影响绘制出的连线(edge)交叉

重现链接

https://codesandbox.io/s/x6-demo-m47ti6?file=/src/FlowGraph.vue

重现步骤

点击重现链接打开demo

点击mock2按钮显示的是交叉的连线,点击mock3按钮显示的是正确的连线

mock2.json和mock3.json的数据差别:nodes数组中,id为2的节点和id为11的节点顺序有区别
mock2.json中nodes数组的id顺序为:1,2,8,11,17
mock3.json中nodes数组的id顺序为:1,8,11,2,17

在控制台输入 graph.getNodes().map(item => item.id),打印出的节点id顺序均为 ["1", "2", "8", "11", "17"]
在控制台输入graph.getEdges().map(item => `${item.source.cell} -> ${item.target.cell}`),打印出的edge均为 ['1 -> 8', '8 -> 11', '8 -> 2', '2 -> 17']

预期行为

使用布局的情况下,节点数组中节点的顺序不应该影响到最终绘制出的图,不然使用布局的意义在哪?

平台

  • 操作系统: [Windows 7]
  • 网页浏览器: [Google Chrome 106]
  • X6 版本: [1.34.5]
  • layout 版本: [0.3.2]

屏幕截图或视频(可选)

image
image

补充说明(可选)

业务场景使用中保存数据,通过graph.getNodes()获取节点数组,但是使用这个节点数组去布局却会导致连线交叉

@x6-bot
Copy link
Contributor

x6-bot bot commented Nov 1, 2022

👋 @appleqzw

Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@NewByVector
Copy link
Contributor

layout 是不支持带连接桩的布局的 只支持节点和连线。 如果带上连接桩的话,处理方式我们思考一下。

@appleqzw
Copy link
Author

appleqzw commented Nov 1, 2022

layout 是不支持带连接桩的布局的 只支持节点和连线。 如果带上连接桩的话,处理方式我们思考一下。

@NewByVector 好的吧,那我只能先手动处理下nodes数组里的节点顺序了

@x6-bot
Copy link
Contributor

x6-bot bot commented Nov 20, 2023

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants