Skip to content

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

Description

@tuyamanke

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

  • "@antv/graphlib": "^2.0.3",
  • "@antv/layout": "1.2.14-beta.8",
  • "@antv/x6": "^2.18.1",
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)

也尝试了下面这种使用方法,也不行。辛苦大佬帮忙看一下具体是什么原因呢?

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions