antvis/G6

Dagre 图上下层次的节点宽度不一致时,怎么居中对齐 #4595

summer-0609 posted onGitHub

问题描述

Dagre 图上下层次的节点宽度不一致时,怎么居中对齐, 目前都是左对齐,如何设置 image

重现链接

null

重现步骤

null

预期行为

null

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • G6 版本: [4.5.1 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response


posted by Yanyan-Wang almost 2 years ago

这个配置看看 https://g6.antv.antgroup.com/api/graph-layout/dagre#layoutcfgalign

默认是undefined为中间对齐 但是看实际效果是左对齐

posted by htyaw almost 2 years ago

已解决,设置 x: -width/2

posted by summer-0609 almost 2 years ago

已解决,设置 x: -width/2

我使用的是jsx语法自定义节点 在style={{x:-width/2,y:-height/2}}设置后依然不生效

posted by htyaw almost 2 years ago

已解决,设置 x: -width/2

我使用的是jsx语法自定义节点 在style={{x:-width/2,y:-height/2}}设置后依然不生效

<img width="438" alt="image" src="https://github.com/antvis/G6/assets/19662502/ede651eb-9d3a-46a1-a553-34eefe1d50a3"> 我是定义的时候在 attrs 里加的

posted by summer-0609 almost 2 years ago

e={{x:-width/2,y:-height/2}}设置后依然不生效

好的 谢谢那我改一下定义节点的方式吧

posted by htyaw almost 2 years ago

Fund this Issue

$0.00
Funded

Pull requests