Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

antv-darge layer 1: The order of the point data will affect the layer, resulting in the failure to meet expectations. 2. When there is a bidirectional edge, an error will be reported when specifying a layer #6480

Open
xiaoxiaofu1 opened this issue Nov 5, 2024 · 0 comments

Comments

@xiaoxiaofu1
Copy link

Describe the bug / 问题描述

一:顺序问题
image
id为我希望和0一个层级的点在0的上方时,layer不符合预期,
当在下方时layer符合预期
image
二:存在平行边时指定layer
image

Reproduction link / 重现链接

No response

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

import { Graph } from '@antv/g6';

const data = {
nodes: [
{ id: '我希望和0一个层级', layer: 0 },
{ id: '0', layer: 0 },
// { id: '我希望和0一个层级', layer: 0 },
{ id: '1', layer: 1 },
{ id: '2', layer: 1 },
{ id: '-1', layer: -1 },
{ id: '-2', layer: -1 }
],
edges: [
{ source: '0', target: '1' },
// { source: '1', target: '0' },
{ source: '0', target: '2' },
{ source: '-1', target: '0' },
{ source: '-2', target: '0' },
],
};

const graph = new Graph({
container: 'container',
autoFit: 'view',
animation: false,
data,
layout: {
type: 'antv-dagre',
rankdir: 'LR',
nodeSize: [60, 30],
nodesep: 60,
ranksep: 40,
controlPoints: true,
},
node: {
type: 'rect',
style: {
size: [60, 30],
radius: 8,
labelText: (d) => d.id,
labelBackground: true,
}
},
edge: {
type: 'polyline',
},
behaviors: ['drag-element', 'drag-canvas', 'zoom-canvas'],
});

graph.render();

window.addPanel((gui) => {
const config = { layout: 'default' };
const layouts = {
default: { type: 'antv-dagre', nodesep: 100, ranksep: 70, controlPoints: true },
LR: { type: 'antv-dagre', rankdir: 'LR', align: 'DL', nodesep: 50, ranksep: 70, controlPoints: true },
'LR&UL': { type: 'antv-dagre', rankdir: 'LR', align: 'UL', controlPoints: true, nodesep: 50, ranksep: 70 },
};

gui.add(config, 'layout', Object.keys(layouts)).onChange(async (layout) => {
graph.setLayout(layouts[layout]);
await graph.layout();
graph.fitCenter();
});
});

G6 Version / G6 版本

🆕 5.x

Operating System / 操作系统

macOS

Browser / 浏览器

Chrome

Additional context / 补充说明

No response

@github-actions github-actions bot changed the title antv-darge layer 一:点数据顺序会影响layer,导致没有到达预期。2.存在双向边时指定layer会报错 antv-darge layer 1: The order of the point data will affect the layer, resulting in the failure to meet expectations. 2. When there is a bidirectional edge, an error will be reported when specifying a layer Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant