The issue has been closed
问题描述
graph.refresh()
graph.refreshPositions()
graph.render()
graph.layout()
都不可以。难道要再从新load data才能重画?
重现链接
https://codesandbox.io/s/g6-forked-mmyxcy?file=/index.js
重现步骤
如上
预期行为
如上
平台
- 操作系统: [ Windows.]
- 网页浏览器: [ Firefox]
- G6 版本: [4.8.15. ]
屏幕截图或视频(可选)
No response
补充说明(可选)
No response

posted by Yanyan-Wang almost 2 years ago 
什么情况下需要 refresh ?
有时候当你做了太多的拖拽,变动,纯粹想重新来过.
现在,我用graph.destory(), 然后再重置解决了。但,如果将来有这么一个redraw/reset/refresh/relayout/recalculate的function也不错。:)
posted by neolee6053 almost 2 years ago
posted by Yanyan-Wang almost 2 years ago 
graph.layout()
不能,可能是因为fx ,fy已更改了(当drag时)
refreshDragedNodePosition(e: IG6GraphEvent) {
const nodes = this.linkViewInstance?.findAllByState('node', 'selected');
if (nodes && nodes.length > 0) {
nodes.forEach(n => {
const model = n.get("model");
model.fx = model.x;
model.fy = model.y;
})
}
const model = e.item?.get("model");
model.fx = e.x;
model.fy = e.y;
}
posted by neolee6053 almost 2 years ago
graph.layout 不影响有 fx fy 的节点,还是会被固定。你是想要重置的时候固定节点被恢复不固定状态?那就把对应数据中的 fx fy 去掉即可
posted by Yanyan-Wang almost 2 years ago
This issue has been closed because it has been outdate for a long time.
Please open a new issue if you still need help.
这个 issue 已经被关闭,因为 它已经过期很久了。
如果你仍然需要帮助,请创建一个新的 issue。
posted by github-actions[bot] 10 months ago