我需要结构推荐才能使用 Cytoscape js
I need recommendation for structure to use Cytoscape js
我们正在使用 Cytoscape + neo4j + spring boot + REST。我们尝试使用一些格式传递给前端,但效果不佳。所以寻找使用 Cytoscape js 的最佳结构。
========
稍后添加。
例如来自 neo4j apoc export json 查询的响应是这样的:
{
"application": {
"type": "node",
"id": "hhj354",
"labels": [
"Application"
],
"properties": {
"appid": "A90378",
"name": "hkjgj",
"status": "In Production"
}
},
"changes": [
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": 453
}
]
}
我需要一些详细的解析代码。只要足够短,后端或前端都可以解析。
提前致谢。
就我而言,前端应该做的计算越少越好。
因此,尽量发送一个 JSON 尽可能接近 cytoscape.js
规范中指定的 格式
图的基本思想是它由节点和边组成,那些元素(正如 cytoscape 所称)有 ids 可以帮助你 select 他们以更简单的方式。
后端无计算
如果你想使用 CALL apoc.export.json.all("all.json",{useTypes:true})
的内置格式 .json 那么你将不得不在前端做一些转换:
responseJson => {
responseJson.map(element => {
return {
group: element.type,
data : {
id: `${element.type}${element.id}`,
myFavouriteProperty: element.property
}
}
}
我们正在使用 Cytoscape + neo4j + spring boot + REST。我们尝试使用一些格式传递给前端,但效果不佳。所以寻找使用 Cytoscape js 的最佳结构。
======== 稍后添加。 例如来自 neo4j apoc export json 查询的响应是这样的:
{
"application": {
"type": "node",
"id": "hhj354",
"labels": [
"Application"
],
"properties": {
"appid": "A90378",
"name": "hkjgj",
"status": "In Production"
}
},
"changes": [
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": sfd
},
{
"node": {
"type": "node",
"id": "fdsf324",
"labels": [
"Change"
],
"properties": {
"type": "gjhk",
"startdate": "2019-11-21 02:11:32"
}
},
"group": "2019-11",
"relation": 453
}
]
}
我需要一些详细的解析代码。只要足够短,后端或前端都可以解析。
提前致谢。
就我而言,前端应该做的计算越少越好。 因此,尽量发送一个 JSON 尽可能接近 cytoscape.js
规范中指定的 格式图的基本思想是它由节点和边组成,那些元素(正如 cytoscape 所称)有 ids 可以帮助你 select 他们以更简单的方式。
后端无计算
如果你想使用 CALL apoc.export.json.all("all.json",{useTypes:true})
的内置格式 .json 那么你将不得不在前端做一些转换:
responseJson => {
responseJson.map(element => {
return {
group: element.type,
data : {
id: `${element.type}${element.id}`,
myFavouriteProperty: element.property
}
}
}