Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
08439167
提交
08439167
authored
8月 11, 2020
作者:
tb53863844
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改bug
上级
6b9d77f6
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
1 行增加
和
592 行删除
+1
-592
Neo4jD3Com.jsx
one_stop_public/libs/Neo4jD3Com.jsx
+0
-591
Neo4jD3.js
one_stop_public/utils/Neo4jD3.js
+1
-1
没有找到文件。
one_stop_public/libs/Neo4jD3Com.jsx
浏览文件 @
08439167
...
...
@@ -43,598 +43,7 @@ export default class Neo4jD3Com extends React.Component {
}
neo4jd3
init
=
(
neo4jData
)
=>
{
/* const x = [
{
"p": {
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
},
"segments": [
{
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"relationship": {
"identity": 6,
"start": 548,
"end": 0,
"type": "ACTED_IN",
"properties": {
"role": "Trinity"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
},
"segments": [
{
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"relationship": {
"identity": 3,
"start": 547,
"end": 0,
"type": "ACTED_IN",
"properties": {
"role": "Morpheus"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
},
"segments": [
{
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"relationship": {
"identity": 0,
"start": 546,
"end": 0,
"type": "ACTED_IN",
"properties": {
"role": "Neo"
}
},
"end": {
"identity": 0,
"labels": [
"Movie"
],
"properties": {
"movieId": "tt0133093",
"title": "The Matrix",
"year": 1999
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"relationship": {
"identity": 7,
"start": 548,
"end": 1,
"type": "ACTED_IN",
"properties": {
"role": "Trinity"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"relationship": {
"identity": 4,
"start": 547,
"end": 1,
"type": "ACTED_IN",
"properties": {
"role": "Morpheus"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"relationship": {
"identity": 1,
"start": 546,
"end": 1,
"type": "ACTED_IN",
"properties": {
"role": "Neo"
}
},
"end": {
"identity": 1,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0234215",
"title": "The Matrix Reloaded",
"year": 2003
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 548,
"labels": [
"Actor"
],
"properties": {
"name": "Carrie-Anne Moss",
"personId": "carrieanne"
}
},
"relationship": {
"identity": 8,
"start": 548,
"end": 2,
"type": "ACTED_IN",
"properties": {
"role": "Trinity"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 547,
"labels": [
"Actor"
],
"properties": {
"name": "Laurence Fishburne",
"personId": "laurence"
}
},
"relationship": {
"identity": 5,
"start": 547,
"end": 2,
"type": "ACTED_IN",
"properties": {
"role": "Morpheus"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
}
}
],
"length": 1.0
}
},
{
"p": {
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
},
"segments": [
{
"start": {
"identity": 546,
"labels": [
"Actor"
],
"properties": {
"name": "Keanu Reeves",
"personId": "keanu"
}
},
"relationship": {
"identity": 2,
"start": 546,
"end": 2,
"type": "ACTED_IN",
"properties": {
"role": "Neo"
}
},
"end": {
"identity": 2,
"labels": [
"Movie",
"Sequel"
],
"properties": {
"movieId": "tt0242653",
"title": "The Matrix Revolutions",
"year": 2003
}
}
}
],
"length": 1.0
}
}
]
var graph = eval(x);
console.log(JSON.stringify(graph))
let nodes =[];
let links = []; // 存放节点和关系
let nodeSet = []; // 存放去重后nodes的id
for (let item of graph) {
// console.log(item.p.start instanceof Array)
// console.log(item.p)
// 重新更改data格式
if(nodeSet.indexOf(item.p.start.identity) == -1){
nodeSet.push(item.p.start.identity)
nodes.push({
id: item.p.start.identity,
labels: item.p.start.labels,
properties: item.p.start.properties
})
}
if(nodeSet.indexOf(item.p.end.identity) == -1){
nodeSet.push(item.p.end.identity)
nodes.push({
id: item.p.end.identity,
labels: item.p.end.labels,
properties: item.p.end.properties
})
}
links.push({
source: item.p.segments[0].relationship.start,
target: item.p.segments[0].relationship.end,
type: item.p.segments[0].relationship.type,
properties: item.p.segments[0].relationship.properties
})
}
console.log(nodes)
console.log(links) */
this
.
neo4jd3
=
new
Neo4jD3
(
'#id_'
+
this
.
uid
,
{
highlight
:
[
{
...
...
one_stop_public/utils/Neo4jD3.js
浏览文件 @
08439167
...
...
@@ -236,7 +236,7 @@ function Neo4jD3(_selector, _options) {
})
.
html
(
function
(
d
)
{
var
_icon
=
icon
(
d
);
return
_icon
?
'&#x'
+
_icon
:
d
.
id
;
return
_icon
?
'&#x'
+
_icon
:
d
.
properties
.
name
;
});
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论