antvis/G6


The issue has been closed
[Bug]: e.getPorts is not a function #6967
dullzb posted onGitHub
Describe the bug / 问题描述
import { Graph } from '@antv/g6';
const data = {
nodes: [
{
id: '1905',
data: {
name: '电子游戏起源'
}
},
{
id: '1906',
data: {
name: '主机演变'
}
},
{
id: '1907',
data: {
name: '游戏类型'
}
},
{
id: '1908',
data: {
name: '游戏产业巨头'
}
},
{
id: '1909',
data: {
name: '街机游戏'
}
},
{
id: '1910',
data: {
name: '在线游戏的兴起'
}
},
{
id: '1911',
data: {
name: '电子游戏文化'
}
},
{
id: '1912',
data: {
name: '游戏开发技术'
}
},
{
id: '1913',
data: {
name: '移动游戏平台'
}
},
{
id: '1914',
data: {
name: '著名游戏系列'
}
},
{
id: '1915',
data: {
name: '独立游戏'
}
},
{
id: '1916',
data: {
name: '电子竞技'
}
},
{
id: '1917',
data: {
name: '玩家社区'
}
},
{
id: '1918',
data: {
name: '游戏音乐'
}
},
{
id: '1919',
data: {
name: '虚拟现实游戏'
}
},
{
id: '1920',
data: {
name: '怀旧复古游戏'
}
},
{
id: '1921',
data: {
name: '多平台游戏发行'
}
},
{
id: '1922',
data: {
name: '游戏法律与伦理'
}
},
{
id: '1923',
data: {
name: '女性在电子游戏中的角色'
}
},
{
id: '1924',
data: {
name: '游戏市场经济'
}
},
{
id: '1925',
data: {
name: '跨文化影响'
}
},
{
id: '1926',
data: {
name: '多人在线战斗竞技场'
}
},
{
id: '1927',
data: {
name: '在线虚拟世界'
}
},
{
id: '1928',
data: {
name: '教育游戏'
}
},
{
id: '1929',
data: {
name: '社交媒体与游戏'
}
},
{
id: '1930',
data: {
name: '增强现实游戏'
}
},
{
id: '1931',
data: {
name: '游戏奖项与评价'
}
},
{
id: '1932',
data: {
name: '角色扮演游戏'
}
},
{
id: '1933',
data: {
name: '模拟类游戏'
}
},
{
id: '1934',
data: {
name: '射击类游戏'
}
},
{
id: '1935',
data: {
name: '策略性游戏'
}
},
{
id: '1936',
data: {
name: '电子游戏艺术'
}
},
{
id: '1937',
data: {
name: '汇流及跨界合作'
}
},
{
id: '1938',
data: {
name: '可访问性与游戏'
}
},
{
id: '2006',
data: {
name: '电子游戏开发者'
}
},
{
id: '2007',
data: {
name: '游戏设计师'
}
},
{
id: '2008',
data: {
name: '电子游戏制作人'
}
},
{
id: '2009',
data: {
name: '游戏艺术家'
}
},
{
id: '2010',
data: {
name: '游戏音效设计师'
}
},
{
id: '2011',
data: {
name: '主机平台创始人'
}
},
{
id: '2012',
data: {
name: '游戏平台先锋'
}
},
{
id: '2013',
data: {
name: '开创性游戏类型设计师'
}
},
{
id: '2014',
data: {
name: '网游先驱'
}
},
{
id: '2015',
data: {
name: '独立游戏革新者'
}
},
{
id: '2016',
data: {
name: '游戏引擎开发者'
}
},
{
id: '2017',
data: {
name: '电子游戏记者'
}
},
{
id: '2018',
data: {
name: '电子竞技开拓者'
}
},
{
id: '2019',
data: {
name: '虚拟现实游戏先锋'
}
},
{
id: '2020',
data: {
name: '社交游戏创始人'
}
},
{
id: '2021',
data: {
name: '教育游戏开发者'
}
},
{
id: '2022',
data: {
name: '动作游戏开创者'
}
},
{
id: '2023',
data: {
name: '角色扮演游戏(RPG)创始人'
}
},
{
id: '2024',
data: {
name: '战略游戏先锋'
}
},
{
id: '2025',
data: {
name: '冒险游戏设计师'
}
},
{
id: '2026',
data: {
name: '射击游戏革新者'
}
},
{
id: '2027',
data: {
name: '体育游戏开发者'
}
},
{
id: '2028',
data: {
name: '音乐游戏先锋'
}
},
{
id: '2029',
data: {
name: '解谜游戏创新者'
}
},
{
id: '2030',
data: {
name: '开放世界游戏先驱'
}
},
{
id: '2031',
data: {
name: '多人合作游戏设计师'
}
},
{
id: '2032',
data: {
name: '恐怖游戏设计师'
}
},
{
id: '2033',
data: {
name: '竞速游戏开发者'
}
},
{
id: '2034',
data: {
name: '叙事驱动游戏创作者'
}
},
{
id: '2035',
data: {
name: '沙盒游戏创新者'
}
},
{
id: '2036',
data: {
name: '益智游戏开发者'
}
},
{
id: '2037',
data: {
name: '模拟游戏先驱'
}
},
{
id: '2038',
data: {
name: '二次元游戏开创者'
}
},
{
id: '2039',
data: {
name: '经典街机游戏设计师'
}
},
{
id: '2040',
data: {
name: '实验性游戏开发者'
}
},
{
id: '2041',
data: {
name: '跨平台游戏开发者'
}
},
{
id: '2042',
data: {
name: '手机游戏革新者'
}
},
{
id: '2043',
data: {
name: '女性游戏设计先驱'
}
},
{
id: '2044',
data: {
name: '开放源码游戏贡献者'
}
},
{
id: '2045',
data: {
name: '云游戏服务提供者'
}
}
],
edges: [
{
id: '1980',
source: '1905',
target: '1909',
data: {
name: '起源于',
description: null
}
},
{
id: '1997',
source: '1917',
target: '1929',
data: {
name: '关联',
description: null
}
},
{
id: '1998',
source: '1917',
target: '1918',
data: {
name: '影响',
description: null
}
},
{
id: '1999',
source: '1917',
target: '1916',
data: {
name: '参与',
description: null
}
},
{
id: '2000',
source: '1917',
target: '1927',
data: {
name: '参与',
description: null
}
},
{
id: '2001',
source: '1936',
target: '1915',
data: {
name: '推动',
description: null
}
},
{
id: '2002',
source: '1936',
target: '1918',
data: {
name: '包括',
description: null
}
},
{
id: '2003',
source: '1912',
target: '1919',
data: {
name: '支持',
description: null
}
},
{
id: '2004',
source: '1912',
target: '1930',
data: {
name: '支持',
description: null
}
},
{
id: '2005',
source: '1912',
target: '1910',
data: {
name: '推动',
description: null
}
},
{
id: '2008',
source: '1912',
target: '1932',
data: {
name: '提升',
description: null
}
},
{
id: '2009',
source: '1912',
target: '1933',
data: {
name: '提升',
description: null
}
},
{
id: '2010',
source: '1908',
target: '1914',
data: {
name: '推出',
description: null
}
},
{
id: '2011',
source: '1908',
target: '1924',
data: {
name: '影响',
description: null
}
},
{
id: '2012',
source: '1908',
target: '1937',
data: {
name: '参与',
description: null
}
},
{
id: '2014',
source: '1924',
target: '1938',
data: {
name: '影响',
description: null
}
},
{
id: '2015',
source: '1924',
target: '1925',
data: {
name: '促进',
description: null
}
},
{
id: '2016',
source: '1924',
target: '1910',
data: {
name: '推动',
description: null
}
},
{
id: '2017',
source: '1924',
target: '1913',
data: {
name: '影响',
description: null
}
},
{
id: '2018',
source: '1924',
target: '1921',
data: {
name: '促进',
description: null
}
},
{
id: '2019',
source: '1924',
target: '1916',
data: {
name: '促进',
description: null
}
},
{
id: '2020',
source: '1922',
target: '1923',
data: {
name: '规范',
description: null
}
},
{
id: '2021',
source: '1922',
target: '1938',
data: {
name: '规范',
description: null
}
},
{
id: '2022',
source: '1922',
target: '1930',
data: {
name: '规范',
description: null
}
},
{
id: '2023',
source: '1922',
target: '1919',
data: {
name: '规范',
description: null
}
},
{
id: '2024',
source: '1922',
target: '1927',
data: {
name: '规范',
description: null
}
},
{
id: '2025',
source: '1922',
target: '1929',
data: {
name: '规范',
description: null
}
},
{
id: '2026',
source: '1914',
target: '1932',
data: {
name: '包括',
description: null
}
},
{
id: '2027',
source: '1914',
target: '1933',
data: {
name: '包括',
description: null
}
},
{
id: '2028',
source: '1914',
target: '1934',
data: {
name: '包括',
description: null
}
},
{
id: '2029',
source: '1914',
target: '1935',
data: {
name: '包括',
description: null
}
},
{
id: '2030',
source: '1914',
target: '1926',
data: {
name: '包括',
description: null
}
},
{
id: '2031',
source: '1910',
target: '1926',
data: {
name: '推动',
description: null
}
},
{
id: '2032',
source: '1910',
target: '1927',
data: {
name: '推动',
description: null
}
},
{
id: '2033',
source: '1910',
target: '1929',
data: {
name: '影响',
description: null
}
},
{
id: '2034',
source: '1913',
target: '1930',
data: {
name: '支持',
description: null
}
},
{
id: '2035',
source: '1913',
target: '1929',
data: {
name: '关联',
description: null
}
},
{
id: '2036',
source: '1913',
target: '1921',
data: {
name: '支持',
description: null
}
},
{
id: '2037',
source: '1921',
target: '1915',
data: {
name: '促进',
description: null
}
},
{
id: '2038',
source: '1921',
target: '1920',
data: {
name: '促进',
description: null
}
},
{
id: '2039',
source: '1937',
target: '1936',
data: {
name: '促进',
description: null
}
},
{
id: '2040',
source: '1937',
target: '1925',
data: {
name: '推动',
description: null
}
},
{
id: '2041',
source: '1937',
target: '1923',
data: {
name: '影响',
description: null
}
},
{
id: '2042',
source: '1937',
target: '1938',
data: {
name: '影响',
description: null
}
},
{
id: '2043',
source: '1937',
target: '1918',
data: {
name: '促进',
description: null
}
},
{
id: '2044',
source: '1920',
target: '1911',
data: {
name: '反映',
description: null
}
},
{
id: '2045',
source: '1920',
target: '1915',
data: {
name: '影响',
description: null
}
},
{
id: '2046',
source: '1925',
target: '1923',
data: {
name: '影响',
description: null
}
},
{
id: '2047',
source: '1925',
target: '1911',
data: {
name: '推动',
description: null
}
},
{
id: '2048',
source: '1925',
target: '1918',
data: {
name: '影响',
description: null
}
},
{
id: '2049',
source: '1925',
target: '1929',
data: {
name: '影响',
description: null
}
},
{
id: '2071',
source: '1905',
target: '1909',
data: {
name: '起始于',
description: null
}
},
{
id: '2072',
source: '1909',
target: '1920',
data: {
name: '继承影响',
description: null
}
},
{
id: '2073',
source: '1906',
target: '2012',
data: {
name: '推动',
description: null
}
}
]
};
const graph = new Graph({
container: 'container',
data,
node: {
type: 'circle',
style: {
labelText: (d) => d.id,
ports: []
},
palette: {
type: 'group',
field: 'cluster',
},
},
layout: {
type: 'force',
linkDistance: 50,
clustering: true,
nodeClusterBy: 'cluster',
clusterNodeStrength: 70,
},
behaviors: ['zoom-canvas', 'drag-canvas'],
});
graph.render();
Reproduction link / 复现链接
https://g6.antv.antgroup.com/examples/layout/force-directed/#force
Steps to Reproduce the Bug or Issue / 重现步骤
将贴的数据放到官方demo就会出现e.getPorts is not a function这个报错
Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他