antvis / antvis/G6

4.7.9版本dagre布局自定义节点,出现重叠情况

Open
#6,183 3 comments 0 reactions 0 assignees View on GitHub
layout v4
Dominant language
TypeScript
Stars
12.3k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug / 问题描述

4.7.9版本dagre布局自定义节点,会出现重叠情况。对应布局代码
layout: {
type: 'dagre',
rankdir: 'LR',
nodesep: 5,
ranksepFunc: (node) => {
// 获取节点的宽度
const nodeWidth = node.attr.computeWidth; // 如果模型中没有宽度,设为默认值
if(nodeWidth > 200) {
return nodeWidth/2;
}
return 100;
},
controlPoints: false,
preventOverlap: true, // 防止节点重叠
}
![企业微信截图_17236230006043](https://github.com/user-attachments/assets/ebe7e9c6-ecfc-4420-b105-c6cbe12ec43f)

### Reproduction link / 重现链接

_No response_

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

_No response_

### G6 Version / G6 版本

4.x

### Operating System / 操作系统

Windows

### Browser / 浏览器

Chrome

### Additional context / 补充说明

_No response_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the G6 4.7.9 dagre layout configuration in the issue, focusing on custom nodes, preventOverlap, nodesep, and ranksepFunc. Reproduce the reported overlap in Chrome on Windows using the supplied settings; done means custom nodes no longer overlap, with behavior checked against the provided screenshot.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
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.