mirror of
https://gitee.com/antv/g6.git
synced 2024-12-03 04:08:32 +08:00
chore: refine
This commit is contained in:
parent
5ebc32f86c
commit
18449ae881
@ -505,7 +505,7 @@ export class DataController {
|
|||||||
data = treeData2GraphData(value);
|
data = treeData2GraphData(value);
|
||||||
} else if (type === 'fetch') {
|
} else if (type === 'fetch') {
|
||||||
// TODO: fetch
|
// TODO: fetch
|
||||||
} else {
|
} else if (!(data as GraphData).nodes) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Input data type is invalid, the type shuold be "graphData", "treeData", or "fetch".',
|
'Input data type is invalid, the type shuold be "graphData", "treeData", or "fetch".',
|
||||||
);
|
);
|
||||||
|
@ -55,7 +55,7 @@ const graphDataCfg = {
|
|||||||
type: 'graphData',
|
type: 'graphData',
|
||||||
value: {
|
value: {
|
||||||
nodes: [
|
nodes: [
|
||||||
{ id: 'node1', data: { isRoot: true, collapsed: true } },
|
{ id: 'node1', data: { isRoot: true } }, // , collapsed: true
|
||||||
{ id: 'node2', data: {} },
|
{ id: 'node2', data: {} },
|
||||||
{ id: 'node3', data: {} },
|
{ id: 'node3', data: {} },
|
||||||
{ id: 'node4', data: {} },
|
{ id: 'node4', data: {} },
|
||||||
@ -64,9 +64,9 @@ const graphDataCfg = {
|
|||||||
edges: [
|
edges: [
|
||||||
{ id: 'edge1', source: 'node1', target: 'node2', data: {} },
|
{ id: 'edge1', source: 'node1', target: 'node2', data: {} },
|
||||||
{ id: 'edge2', source: 'node1', target: 'node3', data: {} },
|
{ id: 'edge2', source: 'node1', target: 'node3', data: {} },
|
||||||
{ id: 'edge3', source: 'node1', target: 'node4', data: {} },
|
// { id: 'edge3', source: 'node1', target: 'node4', data: {} },
|
||||||
// { id: 'edge4', source: 'node2', target: 'node3', data: {} },
|
{ id: 'edge4', source: 'node2', target: 'node3', data: {} },
|
||||||
// { id: 'edge5', source: 'node3', target: 'node4', data: {} },
|
{ id: 'edge5', source: 'node3', target: 'node4', data: {} },
|
||||||
{ id: 'edge6', source: 'node4', target: 'node5', data: {} },
|
{ id: 'edge6', source: 'node4', target: 'node5', data: {} },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -206,8 +206,8 @@ export default async () => {
|
|||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
// },
|
// },
|
||||||
data: treeDataCfg,
|
// data: treeDataCfg,
|
||||||
// data: graphDataCfg,
|
data: graphDataCfg,
|
||||||
modes: {
|
modes: {
|
||||||
default: [
|
default: [
|
||||||
'drag-canvas',
|
'drag-canvas',
|
||||||
@ -239,9 +239,9 @@ export default async () => {
|
|||||||
/** === change layout === */
|
/** === change layout === */
|
||||||
// graph.layout({ type: 'compactBox' });
|
// graph.layout({ type: 'compactBox' });
|
||||||
/** === collapse / expand === */
|
/** === collapse / expand === */
|
||||||
const ids = ['root2', 'root']; //['root']; //['node1']; //
|
// const ids = ['root2', 'root']; //['root']; //['node1']; //
|
||||||
collapsed ? graph.expand(ids) : graph.collapse(ids);
|
// collapsed ? graph.expand(ids) : graph.collapse(ids);
|
||||||
collapsed = !collapsed;
|
// collapsed = !collapsed;
|
||||||
});
|
});
|
||||||
|
|
||||||
graph.on('canvas:contextmenu', (e) => {
|
graph.on('canvas:contextmenu', (e) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user