antvis / antvis/layout

增量节点需要重新布局需要如何使用?

Open
#186 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
276
Forks
60
PR merge metrics
No merged PRs in 30d

Description

版本 `@antv/layout": "^0.3.24`
```
// 创建实例
const layout = new DagreLayout({
type: "dagre",
rankdir: "LR",
align: "UR",
nodesep: 40,
ranksep: 40,
});
// 增量添加节点
layout.updateCfg({
// keepNodeOrder: true,
// nodeOrder: preset.nodes.map((n) => n.id),
preset,
});
// 新老布局合并
preset = {
nodes: preset.nodes.concat(temp.nodes),
edges: preset.nodes.concat(temp.edges)
}
preset = layout.layout(temp)
```
最终的节点位置有问题

测试用例里注释了比较的代码,是因为有问题?

![image](https://github.com/antvis/layout/assets/37919656/391f71d5-7e1c-48ff-989e-f2903bc31d6f)

![image](https://github.com/antvis/layout/assets/37919656/023cd6ae-a72c-4abe-a4ec-e37075b3a5fe)

Contributor guide

Open the contributing guide

Research direction

Start with the DagreLayout updateCfg and layout entry points, then reproduce the incremental-node example using the shown preset merge. Check the test case whose comparison code is commented out and determine whether the resulting positions match the expected incremental layout behavior. Done means the incremental usage is clarified and the relevant comparison test has a defined, passing expectation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.