antvis/G6







Do you want to work on this issue?
You can request for a bounty in order to promote it!
[Bug]: antv-dagre layout doesn't work on collapsed combos #6810
TonyIvanova posted onGitHub
Describe the bug / 问题描述
When using antv-dagr layout on initially collapsed combos - combos show on top of each other. When opening combo - nodes show on top of each other.
Is there a layout that works on collapsed combos or some workaround for this issue?
Appreciate your help
Steps to Reproduce the Bug or Issue / 重现步骤
You can paste this code here: https://g6.antv.antgroup.com/en/examples/layout/dagre#antv-dagre-combo to see it.
import { Graph } from '@antv/g6';
const data = {
"nodes": [
{
"id": "0",
"combo": "A"
},
{
"id": "1",
"combo": "A"
},
{
"id": "2",
"combo": "A"
},
{
"id": "3",
"combo": "A"
},
{
"id": "4",
"combo": "A"
},
{
"id": "5",
"combo": "B"
},
{
"id": "6",
"combo": "A"
},
{
"id": "7",
"combo": "C"
},
{
"id": "8",
"combo": "C"
},
{
"id": "9",
"combo": "A"
},
{
"id": "10",
"combo": "B"
},
{
"id": "11",
"combo": "B"
}
],
"edges": [
{
"id": "edge-102",
"source": "0",
"target": "1"
},
{
"id": "edge-161",
"source": "0",
"target": "2"
},
{
"id": "edge-237",
"source": "1",
"target": "4"
},
{
"id": "edge-253",
"source": "0",
"target": "3"
},
{
"id": "edge-133",
"source": "3",
"target": "4"
},
{
"id": "edge-320",
"source": "2",
"target": "5"
},
{
"id": "edge-355",
"source": "1",
"target": "6"
},
{
"id": "edge-823",
"source": "1",
"target": "7"
},
{
"id": "edge-665",
"source": "3",
"target": "8"
},
{
"id": "edge-884",
"source": "3",
"target": "9"
},
{
"id": "edge-536",
"source": "5",
"target": "10"
},
{
"id": "edge-401",
"source": "5",
"target": "11"
}
],
"combos": [
{
"id": "A",
"style": {
"type": "rect",
collapsed: true,
}
},
{
"id": "B",
"style": {
"type": "rect",
collapsed: true,
}
},
{
"id": "C",
"style": {
"type": "rect",
collapsed: true,
}
}
]
}
const graph = new Graph({
container: 'container',
autoFit: 'center',
data,
combo: {
type: 'rect',
style: {
radius: 8,
labelText: (d) => d.id,
},
},
layout: {
type: 'antv-dagre',
ranksep: 50,
nodesep: 5,
sortByCombo: true,
},
behaviors: ['drag-element', 'drag-canvas', 'zoom-canvas', 'collapse-expand'],
});
graph.render();
Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他