2023-02-02 10:31:36 +08:00
|
|
|
import G6 from '@antv/g6';
|
|
|
|
|
|
|
|
const data = {
|
|
|
|
nodes: [
|
|
|
|
{
|
|
|
|
id: '0',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '0',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '1',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '1',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '2',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '2',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '3',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '3',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '4',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '4',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '5',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '5',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '6',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '6',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '7',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '7',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '8',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '8',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '9',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '9',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '10',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '10',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '11',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '11',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '12',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '12',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '13',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '13',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '14',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '14',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '15',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '15',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '16',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '16',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '17',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '17',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '18',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '18',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '19',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '19',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '20',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '20',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '21',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '21',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '22',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '22',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '23',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '23',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '24',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '24',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '25',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '25',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '26',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '26',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '27',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '27',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '28',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '28',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '29',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '29',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '30',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '30',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '31',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '31',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '32',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '32',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
id: '33',
|
2023-08-28 00:17:22 +08:00
|
|
|
data: {
|
|
|
|
label: '33',
|
|
|
|
},
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
edges: [
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-442',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '1',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-825',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '2',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-100',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '3',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-378',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '4',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-691',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '5',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-983',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '7',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-491',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '8',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-38',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '9',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-547',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '10',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-126',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '11',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-905',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '13',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-931',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '14',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-329',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '15',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-798',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '0',
|
|
|
|
target: '16',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-130',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '2',
|
|
|
|
target: '3',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-132',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '4',
|
|
|
|
target: '5',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-587',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '4',
|
|
|
|
target: '6',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-772',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '5',
|
|
|
|
target: '6',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-582',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '7',
|
|
|
|
target: '13',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-922',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '8',
|
|
|
|
target: '14',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-559',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '9',
|
|
|
|
target: '10',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-915',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '22',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-304',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '14',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-88',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '12',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-343',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '24',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-692',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '21',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-29',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '10',
|
|
|
|
target: '20',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-390',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '11',
|
|
|
|
target: '24',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-46',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '11',
|
|
|
|
target: '22',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-170',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '11',
|
|
|
|
target: '14',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-51',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '12',
|
|
|
|
target: '13',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-387',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '16',
|
|
|
|
target: '17',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-598',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '16',
|
|
|
|
target: '18',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-894',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '16',
|
|
|
|
target: '21',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-448',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '16',
|
|
|
|
target: '22',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-921',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '17',
|
|
|
|
target: '18',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-374',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '17',
|
|
|
|
target: '20',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-11',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '18',
|
|
|
|
target: '19',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-899',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '19',
|
|
|
|
target: '20',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-790',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '19',
|
|
|
|
target: '33',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-294',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '19',
|
|
|
|
target: '22',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-353',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '19',
|
|
|
|
target: '23',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-546',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '20',
|
|
|
|
target: '21',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-105',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '21',
|
|
|
|
target: '22',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-261',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '24',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-393',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '25',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-779',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '26',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-149',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '23',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-313',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '28',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-805',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '30',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-538',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '31',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-884',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '32',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-824',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '22',
|
|
|
|
target: '33',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-519',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '28',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-496',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '27',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-402',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '29',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-736',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '30',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-782',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '31',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-87',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '23',
|
|
|
|
target: '33',
|
|
|
|
},
|
|
|
|
{
|
2023-08-28 00:17:22 +08:00
|
|
|
id: 'edge-27',
|
2023-02-02 10:31:36 +08:00
|
|
|
source: '32',
|
|
|
|
target: '33',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
|
|
|
|
const container = document.getElementById('container');
|
|
|
|
const descriptionDiv = document.createElement('div');
|
|
|
|
descriptionDiv.innerHTML = 'Force layout, linkDistance = 50, preventOverlap: false';
|
|
|
|
container.appendChild(descriptionDiv);
|
|
|
|
|
|
|
|
const width = container.scrollWidth;
|
|
|
|
const height = (container.scrollHeight || 500) - 30;
|
|
|
|
const graph = new G6.Graph({
|
|
|
|
container: 'container',
|
|
|
|
width,
|
|
|
|
height,
|
|
|
|
modes: {
|
|
|
|
default: ['drag-canvas', 'drag-node'],
|
|
|
|
},
|
|
|
|
layout: {
|
|
|
|
type: 'force',
|
|
|
|
linkDistance: 50,
|
|
|
|
},
|
2023-08-28 00:17:22 +08:00
|
|
|
node: (model) => {
|
|
|
|
return {
|
|
|
|
id: model.id,
|
|
|
|
data: {
|
|
|
|
...model.data,
|
|
|
|
labelShape: {
|
|
|
|
text: model.data.label,
|
|
|
|
},
|
|
|
|
labelBackgroundShape: {},
|
|
|
|
animates: {
|
|
|
|
update: [
|
|
|
|
{
|
|
|
|
fields: ['x', 'y'],
|
|
|
|
shapeId: 'group',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2023-02-02 10:31:36 +08:00
|
|
|
},
|
2023-08-28 00:17:22 +08:00
|
|
|
data,
|
2023-02-02 10:31:36 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
if (typeof window !== 'undefined')
|
|
|
|
window.onresize = () => {
|
2023-08-28 00:17:22 +08:00
|
|
|
if (!graph || graph.destroyed) return;
|
2023-02-02 10:31:36 +08:00
|
|
|
if (!container || !container.scrollWidth || !container.scrollHeight) return;
|
2023-08-28 00:17:22 +08:00
|
|
|
graph.setSize([container.scrollWidth, container.scrollHeight - 30]);
|
2023-02-02 10:31:36 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
layoutConfigTranslation();
|
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
layoutConfigTranslation();
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
function layoutConfigTranslation() {
|
|
|
|
setTimeout(() => {
|
|
|
|
descriptionDiv.innerHTML = 'Force layout, linkDistance = 100, preventOverlap: true';
|
2023-08-28 00:17:22 +08:00
|
|
|
graph.layout({
|
|
|
|
type: 'force',
|
2023-02-02 10:31:36 +08:00
|
|
|
linkDistance: 100,
|
|
|
|
preventOverlap: true,
|
|
|
|
nodeSize: 20,
|
|
|
|
});
|
|
|
|
}, 2500);
|
|
|
|
setTimeout(() => {
|
|
|
|
descriptionDiv.innerHTML = 'Force layout, linkDistance = 50, preventOverlap: false';
|
2023-08-28 00:17:22 +08:00
|
|
|
graph.layout({
|
|
|
|
type: 'force',
|
2023-02-02 10:31:36 +08:00
|
|
|
linkDistance: 50,
|
|
|
|
preventOverlap: false,
|
|
|
|
});
|
|
|
|
}, 5000);
|
|
|
|
}
|