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

控制“节点”输出边的个数以及输入的个数 #3710

Closed
shikexin0116 opened this issue Jun 26, 2023 · 5 comments
Closed

控制“节点”输出边的个数以及输入的个数 #3710

shikexin0116 opened this issue Jun 26, 2023 · 5 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@shikexin0116
Copy link

问题描述

我没有找到可以控制节点输出边以及输入边个数的API ,只是看到了一个链接桩是否可以输出多条边,既然有这个API 为何没有控制 节点输出边的Api ? 难不成要控制 节点的连接柱?

重现链接

https://x6.antv.vision/zh/docs/tutorial/basic/interacting

重现步骤

节点与节点之间链接,无法控制边的数量,有API可以控制同一个连接柱只可以输出一条边, 但是没有控制节点输出边的参数

预期行为

可以有控制节点输出和输入数量的节点参数

平台

  • 操作系统: [macOS]
  • 网页浏览器: [Google Chrome]
  • X6 版本: [1.34]

屏幕截图或视频(可选)

No response

补充说明(可选)

API 可否增加可读性,读起来好像散文、个体描写很详细。 节点。链接桩、边、但是组合在一起,就蒙了

@x6-bot
Copy link
Contributor

x6-bot bot commented Jun 26, 2023

👋 @shikexin0116

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

参考这个例子,思路是一样的,在 validateMagnet 中获取输入以及输出边的个数来决定返回值。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Jun 26, 2023
@shikexin0116
Copy link
Author

参考这个例子,思路是一样的,在validateMagnet中获取输入以及输出边的个数来返回决定值。

非常感谢!!!、但是我个人出于UI 的考虑觉得还是四个链接桩还是比较美观的, 我又翻了API 发现了 https://antv-x6.gitee.io/zh/docs/api/graph/model/#getoutgoingedges ///// getOutgoingEdges() getIncomingEdges() 这两个API 可以实现获取节点输入、输出边的数量

@shikexin0116
Copy link
Author

https://antv-x6.gitee.io/zh/docs/api/graph/model/#getoutgoingedges /////
getOutgoingEdges() getIncomingEdges()
这两个方法是获取 输入和输出的边

我使用的方法是在 “edge:connected"
下面粘贴完整代码

  this.graph.on("edge:connected", ({ edge, previous, isNew }) => {
    const sourceNode = edge.getSourceNode();
    const targetNode = edge.getTargetNode()
    if (sourceNode) {
      // 获取源节点的所有出边
      const outgoingEdges = this.graph.getOutgoingEdges(sourceNode);
      console.log('输出边',outgoingEdges.length);
    }        

    if (targetNode) {
      // 获取目标节点的所有入边
      const incomingEdges = this.graph.getIncomingEdges(targetNode);
      console.log('输入边',incomingEdges.length);
    }
  })

VUE2

@x6-bot
Copy link
Contributor

x6-bot bot commented Jun 27, 2024

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 Jun 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

2 participants