X6 icon indicating copy to clipboard operation
X6 copied to clipboard

力导向布局增加动态布局

Open zmcode opened this issue 2 years ago • 7 comments

功能描述

之前也有issue提过 https://github.com/antvis/X6/issues/845, 就是拖动某个节点,其他节点会随之变动 不知道如何实现这个需求呢, 而且例子中,我尝试将shape改成html, 无法实现 image

我在想是否可以尝试使用d3-force https://github.com/d3/d3-force 来实现这个需求? 奈何我技术有限, 期待出一个demo

期望解决方案

期待增加力导向动态布局, 可以使用html来自定义节点

zmcode avatar Jun 15 '22 11:06 zmcode

👋 @yaojin2070

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.

x6-bot[bot] avatar Jun 15 '22 11:06 x6-bot[bot]

布局和 html 节点都是支持的,不知道你的问题具体在?

NewByVector avatar Jun 15 '22 12:06 NewByVector

布局和 html 节点都是支持的,不知道你的问题具体在? image 不支持html类型的shape, 还有不支持节点拖动的时候, 会改变它的位置 image

zmcode avatar Jun 15 '22 12:06 zmcode

你这个使用方式有问题, html 节点需要通过注册的方式才能反序列化,可以先看下 html 节点渲染文档

NewByVector avatar Jun 15 '22 12:06 NewByVector

你这个使用方式有问题, html 节点需要通过注册的方式才能反序列化,可以先看下 html 节点渲染文档

大哥, 能出一个动态改变位置的demo或者代码吗? 就是拖动某个节点,其他节点会变动, https://g6.antv.vision/zh/examples/net/forceDirected#forceDirectedConfigurationTranslate 类似于这个, 实在是无从下手了

zmcode avatar Jun 16 '22 01:06 zmcode

你这个使用方式有问题, html 节点需要通过注册的方式才能反序列化,可以先看下 html 节点渲染文档

image

我看了一下force布局的一些源码还有d3-force的文档, 我看是改给仿真节点添加fx, 和fy就可以改变它的位置, 在设置为null, 可是并没有效果, 这个仿真节点到底是谁 image image

zmcode avatar Jun 16 '22 03:06 zmcode

力导向布局的文档参考这里

NewByVector avatar Jul 09 '22 06:07 NewByVector

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[bot] avatar Aug 22 '23 00:08 x6-bot[bot]