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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ockenden, Samuel
CiS Projekt
Commits
3eab582d
Commit
3eab582d
authored
3 years ago
by
Stahl, Merle
Browse files
Options
Downloads
Patches
Plain Diff
Funktionsnamen angepasst
parent
dd9db1d9
No related branches found
No related tags found
1 merge request
!29
Main
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
assets/cn_default.js
+12
-11
12 additions, 11 deletions
assets/cn_default.js
assets/cn_timeline.js
+13
-14
13 additions, 14 deletions
assets/cn_timeline.js
with
25 additions
and
25 deletions
assets/cn_default.js
+
12
−
11
View file @
3eab582d
/**
/**
* creates a new zoom behavior
* creates a new zoom behavior
*/
*/
var
zoom
=
d3
.
zoom
().
on
(
"
zoom
"
,
handle_
zoom
);
var
zoom
=
d3
.
zoom
().
on
(
"
zoom
"
,
handle_
transformation
);
/**
/**
* creates svg object and associated attributes
* creates svg object and associated attributes
...
@@ -48,7 +48,7 @@ var rect = svg.append("rect")
...
@@ -48,7 +48,7 @@ var rect = svg.append("rect")
.
attr
(
"
height
"
,
height
)
.
attr
(
"
height
"
,
height
)
.
attr
(
"
width
"
,
width
)
.
attr
(
"
width
"
,
width
)
.
style
(
"
fill
"
,
'
white
'
)
.
style
(
"
fill
"
,
'
white
'
)
.
on
(
'
click
'
,
click_
rect
);
.
on
(
'
click
'
,
click_
background
);
/**
/**
* creates svg object (legend) with text, circles and arrows
* creates svg object (legend) with text, circles and arrows
...
@@ -154,7 +154,8 @@ function failure(graph) {
...
@@ -154,7 +154,8 @@ function failure(graph) {
* checks at a fixed interval whether the contents of the JSON file have changed
* checks at a fixed interval whether the contents of the JSON file have changed
and reloads the program if necessary
and reloads the program if necessary
*/
*/
var
intervalId
=
window
.
setInterval
(
function
()
{
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
5000
)
function
check_if_json_changed
()
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
newjson_string
=
JSON
.
stringify
(
graph
)
newjson_string
=
JSON
.
stringify
(
graph
)
var
newjson
=
CryptoJS
.
MD5
(
newjson_string
).
toString
();
var
newjson
=
CryptoJS
.
MD5
(
newjson_string
).
toString
();
...
@@ -164,7 +165,7 @@ var intervalId=window.setInterval(function() {
...
@@ -164,7 +165,7 @@ var intervalId=window.setInterval(function() {
window
.
location
.
reload
()
window
.
location
.
reload
()
}
}
})
})
}
,
5000
);
}
/**
/**
* calls update functions for links and nodes
* calls update functions for links and nodes
...
@@ -213,8 +214,8 @@ function update_nodes(nodes) {
...
@@ -213,8 +214,8 @@ function update_nodes(nodes) {
.
append
(
"
g
"
)
.
append
(
"
g
"
)
.
attr
(
"
class
"
,
"
node
"
)
.
attr
(
"
class
"
,
"
node
"
)
.
call
(
d3
.
drag
()
.
call
(
d3
.
drag
()
.
on
(
"
start
"
,
start_drag
)
.
on
(
"
start
"
,
start_drag
_node
)
.
on
(
"
drag
"
,
dragged
)
.
on
(
"
drag
"
,
dragged
_node
)
);
);
node
.
append
(
"
circle
"
)
node
.
append
(
"
circle
"
)
...
@@ -277,7 +278,7 @@ function click_node(node) {
...
@@ -277,7 +278,7 @@ function click_node(node) {
/**
/**
* removes the highlights of the circles and their links
* removes the highlights of the circles and their links
*/
*/
function
click_
rect
()
{
function
click_
background
()
{
fix_nodes
(
node
);
fix_nodes
(
node
);
d3
.
selectAll
(
"
.circle
"
).
style
(
"
stroke
"
,
"
none
"
)
d3
.
selectAll
(
"
.circle
"
).
style
(
"
stroke
"
,
"
none
"
)
d3
.
selectAll
(
"
.link
"
)
d3
.
selectAll
(
"
.link
"
)
...
@@ -389,7 +390,7 @@ function handle_tick() {
...
@@ -389,7 +390,7 @@ function handle_tick() {
* initializes dragging of the node
* initializes dragging of the node
* @param {object} node - node
* @param {object} node - node
*/
*/
function
start_drag
(
node
)
{
function
start_drag
_node
(
node
)
{
d3
.
select
(
this
).
raise
();
d3
.
select
(
this
).
raise
();
if
(
!
d3
.
event
.
active
)
if
(
!
d3
.
event
.
active
)
simulation
.
alphaTarget
(
0.3
).
restart
()
simulation
.
alphaTarget
(
0.3
).
restart
()
...
@@ -402,7 +403,7 @@ function start_drag(node) {
...
@@ -402,7 +403,7 @@ function start_drag(node) {
* applies dragging to the node
* applies dragging to the node
* @param {object} node - node
* @param {object} node - node
*/
*/
function
dragged
(
node
)
{
function
dragged
_node
(
node
)
{
node
.
fx
=
d3
.
event
.
x
;
node
.
fx
=
d3
.
event
.
x
;
node
.
fy
=
d3
.
event
.
y
;
node
.
fy
=
d3
.
event
.
y
;
fix_nodes
(
node
);
fix_nodes
(
node
);
...
@@ -424,7 +425,7 @@ function fix_nodes(this_node) {
...
@@ -424,7 +425,7 @@ function fix_nodes(this_node) {
/**
/**
* applies the transformation (zooming or dragging) to the g element
* applies the transformation (zooming or dragging) to the g element
*/
*/
function
handle_
zoom
()
{
function
handle_
transformation
()
{
d3
.
select
(
'
g
'
).
attr
(
"
transform
"
,
d3
.
event
.
transform
);
d3
.
select
(
'
g
'
).
attr
(
"
transform
"
,
d3
.
event
.
transform
);
}
}
...
...
This diff is collapsed.
Click to expand it.
assets/cn_timeline.js
+
13
−
14
View file @
3eab582d
/**
/**
* creates a new zoom behavior
* creates a new zoom behavior
*/
*/
var
zoom
=
d3
.
zoom
().
on
(
"
zoom
"
,
handle_
zoom
);
var
zoom
=
d3
.
zoom
().
on
(
"
zoom
"
,
handle_
transformation
);
/**
/**
* creates svg object and associated attributes
* creates svg object and associated attributes
...
@@ -48,7 +48,7 @@ var rect = svg.append("rect")
...
@@ -48,7 +48,7 @@ var rect = svg.append("rect")
.
attr
(
"
height
"
,
height
)
.
attr
(
"
height
"
,
height
)
.
attr
(
"
width
"
,
width
)
.
attr
(
"
width
"
,
width
)
.
style
(
"
fill
"
,
'
white
'
)
.
style
(
"
fill
"
,
'
white
'
)
.
on
(
'
click
'
,
click_
rect
);
.
on
(
'
click
'
,
click_
background
);
/**
/**
* creates svg object (legend) with text, circles and arrows
* creates svg object (legend) with text, circles and arrows
...
@@ -171,7 +171,8 @@ function failure(graph) {
...
@@ -171,7 +171,8 @@ function failure(graph) {
* checks at a fixed interval whether the contents of the JSON file have changed
* checks at a fixed interval whether the contents of the JSON file have changed
and reloads the program if necessary
and reloads the program if necessary
*/
*/
var
intervalId
=
window
.
setInterval
(
function
()
{
var
intervalId
=
window
.
setInterval
(
check_if_json_changed
,
5000
)
function
check_if_json_changed
()
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
d3
.
json
(
"
json_text.json
"
).
then
(
function
(
graph
)
{
newjson_string
=
JSON
.
stringify
(
graph
)
newjson_string
=
JSON
.
stringify
(
graph
)
var
newjson
=
CryptoJS
.
MD5
(
newjson_string
).
toString
();
var
newjson
=
CryptoJS
.
MD5
(
newjson_string
).
toString
();
...
@@ -181,7 +182,7 @@ var intervalId=window.setInterval(function() {
...
@@ -181,7 +182,7 @@ var intervalId=window.setInterval(function() {
window
.
location
.
reload
()
window
.
location
.
reload
()
}
}
})
})
}
,
5000
);
}
/**
/**
* calls update functions for links, nodes and x-axis
* calls update functions for links, nodes and x-axis
...
@@ -190,7 +191,7 @@ var intervalId=window.setInterval(function() {
...
@@ -190,7 +191,7 @@ var intervalId=window.setInterval(function() {
* @param {object} links - links
* @param {object} links - links
*/
*/
function
update
(
links
,
nodes
)
{
function
update
(
links
,
nodes
)
{
update
XA
xis
(
nodes
);
update
_xa
xis
(
nodes
);
update_links
(
links
);
update_links
(
links
);
update_nodes
(
nodes
);
update_nodes
(
nodes
);
...
@@ -208,7 +209,7 @@ function update(links, nodes) {
...
@@ -208,7 +209,7 @@ function update(links, nodes) {
* initializes and shows x-axis
* initializes and shows x-axis
* @param {object} nodes - nodes
* @param {object} nodes - nodes
*/
*/
function
update
XA
xis
(
nodes
)
{
function
update
_xa
xis
(
nodes
)
{
years
=
[];
years
=
[];
for
(
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
nodes
.
length
;
i
++
)
{
years
.
push
(
parseInt
(
parseInt
(
/
\d{4}\s
*$/
.
exec
(
nodes
[
i
][
"
year
"
]))));
years
.
push
(
parseInt
(
parseInt
(
/
\d{4}\s
*$/
.
exec
(
nodes
[
i
][
"
year
"
]))));
...
@@ -249,8 +250,8 @@ function update_nodes(nodes) {
...
@@ -249,8 +250,8 @@ function update_nodes(nodes) {
.
append
(
"
g
"
)
.
append
(
"
g
"
)
.
attr
(
"
class
"
,
"
node
"
)
.
attr
(
"
class
"
,
"
node
"
)
.
call
(
d3
.
drag
()
.
call
(
d3
.
drag
()
.
on
(
"
start
"
,
start_drag
)
.
on
(
"
start
"
,
start_drag
_node
)
.
on
(
"
drag
"
,
dragged
)
.
on
(
"
drag
"
,
dragged
_node
)
);
);
node
.
append
(
"
circle
"
)
node
.
append
(
"
circle
"
)
...
@@ -314,7 +315,7 @@ function click_node(node) {
...
@@ -314,7 +315,7 @@ function click_node(node) {
/**
/**
* removes the highlights of the circles and their links
* removes the highlights of the circles and their links
*/
*/
function
click_
rect
()
{
function
click_
background
()
{
fix_nodes
(
node
);
fix_nodes
(
node
);
d3
.
selectAll
(
"
.circle
"
).
style
(
"
stroke
"
,
"
none
"
)
d3
.
selectAll
(
"
.circle
"
).
style
(
"
stroke
"
,
"
none
"
)
d3
.
selectAll
(
"
.link
"
)
d3
.
selectAll
(
"
.link
"
)
...
@@ -426,11 +427,10 @@ function handle_tick() {
...
@@ -426,11 +427,10 @@ function handle_tick() {
* initializes the dragging of the node
* initializes the dragging of the node
* @param {object} node - node
* @param {object} node - node
*/
*/
function
start_drag
(
node
)
{
function
start_drag
_node
(
node
)
{
d3
.
select
(
this
).
raise
();
d3
.
select
(
this
).
raise
();
if
(
!
d3
.
event
.
active
)
if
(
!
d3
.
event
.
active
)
simulation
.
alphaTarget
(
0.3
).
restart
()
simulation
.
alphaTarget
(
0.3
).
restart
()
//node.fx = node.x;
node
.
fy
=
node
.
y
;
node
.
fy
=
node
.
y
;
fix_nodes
(
node
);
fix_nodes
(
node
);
}
}
...
@@ -439,8 +439,7 @@ function start_drag(node) {
...
@@ -439,8 +439,7 @@ function start_drag(node) {
* applies the dragging to the node
* applies the dragging to the node
* @param {object} node - node
* @param {object} node - node
*/
*/
function
dragged
(
node
)
{
function
dragged_node
(
node
)
{
//node.fx = d3.event.x;
node
.
fy
=
d3
.
event
.
y
;
node
.
fy
=
d3
.
event
.
y
;
fix_nodes
(
node
);
fix_nodes
(
node
);
}
}
...
@@ -461,7 +460,7 @@ function fix_nodes(this_node) {
...
@@ -461,7 +460,7 @@ function fix_nodes(this_node) {
/**
/**
* applies the transformation (zooming or dragging) to the g element
* applies the transformation (zooming or dragging) to the g element
*/
*/
function
handle_
zoom
()
{
function
handle_
transformation
()
{
d3
.
select
(
'
g
'
).
attr
(
"
transform
"
,
d3
.
event
.
transform
);
d3
.
select
(
'
g
'
).
attr
(
"
transform
"
,
d3
.
event
.
transform
);
var
new_xScale
=
d3
.
event
.
transform
.
rescaleX
(
xscale
)
var
new_xScale
=
d3
.
event
.
transform
.
rescaleX
(
xscale
)
gX
.
call
(
xAxis
.
scale
(
new_xScale
));
gX
.
call
(
xAxis
.
scale
(
new_xScale
));
...
...
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