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

收缩后,怎么更新布局 #3944

Closed
Hantongya opened this issue Sep 27, 2023 · 10 comments
Closed

收缩后,怎么更新布局 #3944

Hantongya opened this issue Sep 27, 2023 · 10 comments
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@Hantongya
Copy link

Hantongya commented Sep 27, 2023

问题描述

点击收缩按钮后,节点收缩后,但是整体布局没有自适应,怎么解决呢?

重现链接

https://x6.antv.vision/zh/examples/showcase/practices#tree

重现步骤

点击收缩按钮

预期行为

点击收缩按钮后,节点收缩后,整体布局也可以自适应,如下图红框位置变小

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox ...]
  • X6 版本: [2.11.1 ...]

屏幕截图或视频(可选)

image

补充说明(可选)

No response

@x6-bot
Copy link
Contributor

x6-bot bot commented Sep 27, 2023

👋 @Hantongya

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.

@Hantongya
Copy link
Author

Hantongya commented Sep 27, 2023

如何在收缩节点的时候,缩短之间的距离呢,router用的manhattan算法,渲染用的Hierarchy.mindmap

@Hantongya
Copy link
Author

大佬们,求指导。。。

@NewByVector
Copy link
Contributor

重新布局一次。

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Oct 1, 2023
@Hantongya
Copy link
Author

重新布局一次。

具体调什么方法呢,可以详细说一下嘛?

@Hantongya
Copy link
Author

已解决

@kingyue737
Copy link
Contributor

想请问一下是怎么解决的?
刚接触X6,没搜到和布局相关的解答,我是这么重新布局的,不知道是不是最佳实践:

function resetLayout() {
  graph.fromJSON(
    dagreLayout.layout({
      nodes: graph.getNodes().map((n) => n.store.data),
      edges: graph.getEdges().map((e) => e.store.data),
    }),
  )
}

@xiaoqiao112
Copy link

已解决

你好,想请问下是如何解决的

@qiufeihong2018
Copy link
Contributor

fromJSON(...)
按照指定的 JSON 数据渲染节点和边。

支持节点/边元数据数组,按照数组顺序渲染节点和边。

这个方法不就可以了

@xiaoqiao112
Copy link

fromJSON(...) 按照指定的 JSON 数据渲染节点和边。

支持节点/边元数据数组,按照数组顺序渲染节点和边。

这个方法不就可以了
不行,执行后没有重新布局,中间的间距没有收起来,而且这个方法在思维导图里用时有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

5 participants