antvis / antvis/layout

使用DagreLayout布局时,ranker参数无效,无论设置成什么,布局样式还是不变。

Open
#234 0 comments 0 reactions 0 assignees View on GitHub
layout/antv-dagre
Dominant language
TypeScript
Stars
276
Forks
60
PR merge metrics
No merged PRs in 30d

Description

我看这个 issue https://github.com/antvis/layout/issues/206 中也提到了这个问题,当节点最终有汇合的时候 ranker 参数就不能正常工作。image
使用DagreLayout布局时,ranker参数无效,无论设置成什么,布局样式还是不变。
我用的npm依赖:

- "@antv/graphlib": "^2.0.3",
- "@antv/layout": "1.2.14-beta.8",
- "@antv/x6": "^2.18.1",

```javascript
import { Graph as GraphLibGraph } from '@antv/graphlib';
import { DagreLayout, EdgeData, NodeData } from '@antv/layout'
const dagre = new DagreLayout({
rankdir: 'TB',
ranksep: 80,
ranker: 'network-simplex',
nodeSize: nodeData => {
return [nodeData.data.width, nodeData.data.height]
}
});
const layoutPosition = await dagre.execute(graphLibGraph)
```
也尝试了下面这种使用方法,也不行。辛苦大佬帮忙看一下具体是什么原因呢?
```javascript
const option: DagreLayoutOptions = {
rankdir: 'TB',
ranksep: 80,
ranker: 'network-simplex',
nodeSize: nodeData => {
return [nodeData.data.width, nodeData.data.height]
}
}
const dagre = new DagreLayout(option);
const layoutPosition = await dagre.execute(graphLibGraph, option)
```

Contributor guide

Open the contributing guide

Research direction

Start at the DagreLayout entry point and reproduce the report with the supplied rankdir, ranksep, ranker, and nodeSize options on a graph whose nodes converge. Compare the behavior with the related issue 206. Done means changing ranker produces the expected layout differences for the reported case.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.