Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CiS Projekt
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
e6e44a75
Commit
e6e44a75
authored
3 years ago
by
Katja
Browse files
Options
Downloads
Patches
Plain Diff
comments
parent
355a66d6
No related branches found
Branches containing commit
No related tags found
2 merge requests
!10
Output
,
!9
Main
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Output/cn.js
+25
-1
25 additions, 1 deletion
Output/cn.js
with
25 additions
and
1 deletion
Output/cn.js
+
25
−
1
View file @
e6e44a75
...
...
@@ -56,6 +56,12 @@ d3.json("json_text.json").then(function(graph) {
update
(
graph
.
links
,
graph
.
nodes
);
})
/**
* display links and nodes (with circle and text)
* initialises link, node objects
* @param {object} nodes - nodes
* @param {object} links - links
*/
function
update
(
links
,
nodes
)
{
link
=
g
.
append
(
"
g
"
)
.
selectAll
(
"
.link
"
)
...
...
@@ -118,10 +124,20 @@ simulation.force("link")
.
links
(
links
);
}
/**
* returns true if link is directly connected to node and false if it is not
* @param {object} node - node
* @param {object} link - link
*/
function
isLinkForNode
(
node
,
link
){
return
link
.
source
.
index
==
node
.
index
||
link
.
target
.
index
==
node
.
index
;
}
/**
* sets color of link (line and arrowhead) to black if it is directly connected to node
* and to grey otherwise
* @param {object} node - node
*/
function
marklink
(
node
){
d3
.
selectAll
(
"
.link
"
)
.
style
(
"
stroke
"
,
function
(
o
)
{
...
...
@@ -130,6 +146,10 @@ function marklink(node){
return
isLinkForNode
(
node
,
o
)
?
marker
(
'
#000000
'
)
:
marker
(
'
#999
'
);})
}
/**
* creates arrowhead and returns its url
* @param {string} color - color of arrowhead
*/
function
marker
(
color
)
{
svg
.
append
(
'
defs
'
).
append
(
'
marker
'
)
//arrowhead
.
attr
(
'
id
'
,
color
.
replace
(
"
#
"
,
""
))
...
...
@@ -149,7 +169,7 @@ function marker(color) {
/**
* returns last name of first author
* @param {string} authors -
T
he comma-separated string of authors
* @param {string} authors -
t
he comma-separated string of authors
*/
function
firstauthor
(
authors
){
if
(
/,/
.
test
(
authors
)
==
false
){
...
...
@@ -161,6 +181,10 @@ function firstauthor(authors){
return
firstauthor
[
1
]
}
/**
* outputs node info to textbox
* @param {object} d - data of current node
*/
function
textfunc
(
d
){
document
.
getElementById
(
'
textbox
'
).
innerHTML
=
"
Title:
"
+
'
</br>
'
+
d
.
name
+
'
</br>
'
+
'
</br>
'
+
"
Author:
"
+
'
</br>
'
+
d
.
author
+
'
</br>
'
+
'
</br>
'
+
"
Year:
"
+
'
</br>
'
+
d
.
year
+
'
</br>
'
+
'
</br>
'
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment