Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
R
relation-graph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郭铭瑶
relation-graph
Commits
8067f8f4
Commit
8067f8f4
authored
Aug 26, 2021
by
郭铭瑶
🤘
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化
parent
4d35e7f3
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
37 deletions
+44
-37
useD3.js
src/util/useD3.js
+44
-37
No files found.
src/util/useD3.js
View file @
8067f8f4
...
@@ -687,17 +687,9 @@ export default class RelationGraph {
...
@@ -687,17 +687,9 @@ export default class RelationGraph {
})
// x 坐标为两点中心距离减去自身长度一半
})
// x 坐标为两点中心距离减去自身长度一半
// 5.修改节点的位置
// 5.修改节点的位置
this
.
circles
.
attr
(
'cx'
,
(
d
)
=>
d
.
x
).
attr
(
'cy'
,
(
d
)
=>
d
.
y
)
this
.
squares
.
attr
(
'x'
,
(
d
)
=>
d
.
x
-
r
)
.
attr
(
'y'
,
(
d
)
=>
d
.
y
-
r
)
.
attr
(
'points'
,
(
d
)
=>
polygonPoints
(
d
.
x
,
d
.
y
,
r
,
6
))
this
.
pentagons
.
attr
(
'x'
,
(
d
)
=>
d
.
x
-
r
)
.
attr
(
'y'
,
(
d
)
=>
d
.
y
-
r
)
.
attr
(
'points'
,
(
d
)
=>
polygonPoints
(
d
.
x
,
d
.
y
,
r
,
10
))
// 让menu随圆圈移动
// 让menu随圆圈移动
if
(
this
.
circles
)
{
this
.
circles
.
attr
(
'cx'
,
(
d
)
=>
d
.
x
).
attr
(
'cy'
,
(
d
)
=>
d
.
y
)
this
.
circles
.
each
(
function
()
{
this
.
circles
.
each
(
function
()
{
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
if
(
!
menuEle
.
empty
())
{
if
(
!
menuEle
.
empty
())
{
...
@@ -707,6 +699,13 @@ export default class RelationGraph {
...
@@ -707,6 +699,13 @@ export default class RelationGraph {
menuEle
.
attr
(
'transform'
,
`translate(
${
cx
}
,
${
cy
}
)`
).
raise
()
menuEle
.
attr
(
'transform'
,
`translate(
${
cx
}
,
${
cy
}
)`
).
raise
()
}
}
})
})
}
if
(
this
.
squares
)
{
this
.
squares
.
attr
(
'x'
,
(
d
)
=>
d
.
x
-
r
)
.
attr
(
'y'
,
(
d
)
=>
d
.
y
-
r
)
.
attr
(
'points'
,
(
d
)
=>
polygonPoints
(
d
.
x
,
d
.
y
,
r
,
6
))
this
.
squares
.
each
(
function
()
{
this
.
squares
.
each
(
function
()
{
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
if
(
!
menuEle
.
empty
())
{
if
(
!
menuEle
.
empty
())
{
...
@@ -716,6 +715,13 @@ export default class RelationGraph {
...
@@ -716,6 +715,13 @@ export default class RelationGraph {
menuEle
.
attr
(
'transform'
,
`translate(
${
cx
}
,
${
cy
}
)`
).
raise
()
menuEle
.
attr
(
'transform'
,
`translate(
${
cx
}
,
${
cy
}
)`
).
raise
()
}
}
})
})
}
if
(
this
.
pentagons
)
{
this
.
pentagons
.
attr
(
'x'
,
(
d
)
=>
d
.
x
-
r
)
.
attr
(
'y'
,
(
d
)
=>
d
.
y
-
r
)
.
attr
(
'points'
,
(
d
)
=>
polygonPoints
(
d
.
x
,
d
.
y
,
r
,
10
))
this
.
pentagons
.
each
(
function
()
{
this
.
pentagons
.
each
(
function
()
{
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
const
menuEle
=
d3
.
select
(
this
.
nextSibling
)
if
(
!
menuEle
.
empty
())
{
if
(
!
menuEle
.
empty
())
{
...
@@ -726,6 +732,7 @@ export default class RelationGraph {
...
@@ -726,6 +732,7 @@ export default class RelationGraph {
}
}
})
})
}
}
}
// 高亮元素及其相关的元素
// 高亮元素及其相关的元素
highlightObject
(
obj
)
{
highlightObject
(
obj
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment