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

关于fromJson数据导入页面时自定义节点iimage无法显示的问题 #2370

Closed
lvxiansen opened this issue Jul 18, 2022 · 3 comments
Closed
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions

Comments

@lvxiansen
Copy link

问题描述

使用fromJson进行数据的前端展示时,发现自定义节点图片Image无法显示。例如
data.nodes.forEach((item) => {
model.nodes?.push({
id: item.id,
shape: 'circle',
width: item.size>100?item.size:100,
height: item.size>100?item.size:100,
x: item.x,
y: item.y,
attrs: {
body: {
fill: '#5F95FF',
stroke: 'transparent',
},
image: {
'xlink:href': 'https://gw.alipayobjects.com/os/s/prod/antv/assets/image/logo-with-text-73b8a.svg',
}
},
ports: {
groups: {
po: {
position: {
name: "ellipseSpread",
args: {
start: 0
},
},
label: {
position: "left"
},
attrs: {
circle: {
r: 10,
magnet: true,
stroke: "#31d0c6",
strokeWidth: 2,
fill: "#fff"
}
}
}
},
items://...
},
})
})
const forceLayout = new ForceLayout({
type: 'force',
center: [369, 180],
preventOverlap: true,
linkDistance: () => {
return 100
},
nodeStrength: () => {
return -10
},
edgeStrength: () => {
return 0.1
},
tick: () => {
const model = getModelFromOriginData(data)
graph.fromJSON(model)
},
})
forceLayout.layout(data)
此时image无法在前端显示

重现链接

重现步骤

页面展示时

预期行为

希望可以显示自定义image

平台

  • 操作系统: [macOS, Windows, Linux, React Native ...]
  • 网页浏览器: [Google Chrome, Safari, Firefox]
  • X6 版本: [1.28.2 ... ]

屏幕截图或视频(可选)

No response

补充说明(可选)

No response

@NewByVector
Copy link
Contributor

image 配置只有在 image 节点才有效果,参考 demo

@NewByVector NewByVector added the type: discussion 讨论 Usage questions, guidance, and other discussions label Jul 20, 2022
@NewByVector
Copy link
Contributor

请问上面的回答有解决你的问题吗,为了高效沟通,我们暂时关闭这个 issue,如果有必要,请重新开一个新的 issue。

@x6-bot
Copy link
Contributor

x6-bot bot commented Aug 22, 2023

This thread has been automatically locked because it has not had recent activity.

Please open a new issue for related bugs and link to relevant comments in this thread.

@x6-bot x6-bot bot locked as resolved and limited conversation to collaborators Aug 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: discussion 讨论 Usage questions, guidance, and other discussions
Projects
None yet
Development

No branches or pull requests

2 participants