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

请问同一棵树,是否支持纵向、横向多种方向布局呢? #302

Closed
qingyun1029 opened this issue May 11, 2024 · 3 comments
Closed

Comments

@qingyun1029
Copy link

比如我的纵向树,里面的某一些节点希望可以横向布局,这种需求支持吗?
谢谢!

@seeksdream
Copy link
Owner

你是想要这样的效果吗:
image

这种布局目前只能通过混合布局来实现,实现起来会难一些,但是可以实现非常复杂的需求:
https://www.relation-graph.com/#/demo/vue2?id=mix-layout-2

@qingyun1029
Copy link
Author

你是想要这样的效果吗: image

这种布局目前只能通过混合布局来实现,实现起来会难一些,但是可以实现非常复杂的需求: https://www.relation-graph.com/#/demo/vue2?id=mix-layout-2

谢谢,是的,不同类型的节点,希望可以布局方向不同。
另外,我发现你这个demo树,隐藏、展开节点时,布局不会乱,我看其他的例子,展开隐藏节点时,会先显示出来(和其他的节点重叠),然后重新布局位置,明显你这种方式好很多,请问怎么设置的呢?

@seeksdream
Copy link
Owner

你是想要这样的效果吗: image
这种布局目前只能通过混合布局来实现,实现起来会难一些,但是可以实现非常复杂的需求: https://www.relation-graph.com/#/demo/vue2?id=mix-layout-2

谢谢,是的,不同类型的节点,希望可以布局方向不同。 另外,我发现你这个demo树,隐藏、展开节点时,布局不会乱,我看其他的例子,展开隐藏节点时,会先显示出来(和其他的节点重叠),然后重新布局位置,明显你这种方式好很多,请问怎么设置的呢?

你说的【我看其他的例子,展开隐藏节点时,会先显示出来】这个可能指的是默认的展示多个关系网的方式:
https://www.relation-graph.com/#/demo/vue2?id=multi-group-2
这种只适用于简单的应用场景,比如有很多个小关系网、数据都不是很多、相关之间没有什么关联的。

而在【混合布局】中,是会针对不同分组的节点创建多个不同的布局器对象:
const layout1 = RGLayouterUtils.createLayout(layoutOptions, graphInstance.options, graphInstance);
布局器对象会为各自需要处理的节点们分配位置。【混合布局】的示例:
https://www.relation-graph.com/#/demo/vue2?id=mix-layout
https://www.relation-graph.com/#/demo/vue2?id=mix-layout-3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants