antvis/G6

The layout using antv-dagre and orthogonal routing for flowcharts generates unnecessary control points. #6397

Cay222 posted onGitHub

Describe the bug / 问题描述

image 流程图对从WF7-002节指向WF8-004节点的这条边产生了多余的控制点,我希望可以实现红色箭头的效果。

https://codesandbox.io/p/sandbox/vrtql6

Steps to Reproduce the Bug or Issue / 重现步骤

No response

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

Windows

Browser / 浏览器

Chrome

Additional context / 补充说明

No response


试下调整布局参数 nodeSize

posted by yvonneyx 7 months ago

调整布局参数nodeSize 我是这样设置的 nodeSize,不知道为什么没有生效,还是有一样的问题。

posted by Cay222 7 months ago

这是由于 dagre 布局计算出来的控制点在节点两侧,没在节点中心轴上导致的。

image

有两种方式来解决:

  1. 基于 dagre 自定义布局,复写控制点计算逻辑,效果可控
  2. 忽略布局计算的控制点,借助折线的正交路由来绘制,效果不可控
  edge: {
    type: 'polyline',
    style: {
      endArrow: true,
      controlPoints: [],
      router: {
        type: 'orth',
        padding: 30
      }
    },
  },
posted by yvonneyx 6 months ago

非常感谢!问题已解决。👍👍👍

posted by Cay222 6 months ago

Fund this Issue

$0.00
Funded

Pull requests