Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clinicaltrials
Project
Project
Details
Activity
Releases
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
david Chavalarias
clinicaltrials
Commits
21325521
Commit
21325521
authored
Oct 11, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new metric for growth_rate has new function for colors
parent
e5fa238c
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
62 deletions
+138
-62
extras_explorerjs.js
extras_explorerjs.js
+64
-62
sigmaUtils.js
tinawebJS/sigmaUtils.js
+74
-0
No files found.
extras_explorerjs.js
View file @
21325521
This diff is collapsed.
Click to expand it.
tinawebJS/sigmaUtils.js
View file @
21325521
...
...
@@ -341,6 +341,80 @@ function clustersBy(daclass) {
TW
.
partialGraph
.
draw
();
}
// rewrite of clustersBy with binning and for attributes that can have negative float values
function
colorsRelByBins
(
daclass
)
{
cancelSelection
(
false
);
// 13 colors
var
binColors
=
[
"#005197"
,
//blue
// "#3c76fb",
"#5c8af2"
,
"#64c5f2"
,
"#64e0f2"
,
"#bae64f"
,
//epsilon
"#f9f008"
,
"#f9da08"
,
"#fab207"
,
"#fa9607"
,
"#fa6e07"
,
"#fa4607"
,
// red
"#991B1E"
];
// £TODO calculate thresholds like eg d3.histogram
// var thresholdsMin = [-100,-75,-50,-25,-10,10,25,50,75,100,125,150, 1000000]
var
thresholdsMin
=
[
-
75
,
-
50
,
-
25
,
-
10
,
10
,
25
,
50
,
75
,
100
,
125
,
150
,
1000000
]
// get the nodes
var
v_nodes
=
getVisibleNodes
();
for
(
var
i
in
v_nodes
)
{
var
theId
=
v_nodes
[
i
].
id
var
theNode
=
TW
.
Nodes
[
theId
]
var
attval
=
(
isUndef
(
theNode
.
attributes
)
||
isUndef
(
theNode
.
attributes
[
daclass
])
)?
v_nodes
[
i
][
daclass
]:
theNode
.
attributes
[
daclass
];
var
theVal
=
parseFloat
(
attval
)
if
(
!
isNaN
(
theVal
)
)
{
//is float
// iterate over bins
for
(
var
j
=
0
;
j
<
thresholdsMin
.
length
-
1
;
j
++
)
{
var
binMin
=
thresholdsMin
[
j
]
var
binMax
=
thresholdsMin
[(
j
+
1
)]
if
((
theVal
>=
binMin
)
&&
(
theVal
<
binMax
))
{
TW
.
partialGraph
.
_core
.
graph
.
nodesIndex
[
theId
].
color
=
binColors
[
j
]
break
}
}
}
}
TW
.
partialGraph
.
refresh
();
TW
.
partialGraph
.
draw
();
// [ Edge-colour by source-target nodes-colours combination ]
var
v_edges
=
getVisibleEdges
();
for
(
var
e
in
v_edges
)
{
var
e_id
=
v_edges
[
e
].
id
;
var
a
=
v_edges
[
e
].
source
.
color
;
var
b
=
v_edges
[
e
].
target
.
color
;
a
=
hex2rga
(
a
);
b
=
hex2rga
(
b
);
var
r
=
(
a
[
0
]
+
b
[
0
])
>>
1
;
var
g
=
(
a
[
1
]
+
b
[
1
])
>>
1
;
var
b
=
(
a
[
2
]
+
b
[
2
])
>>
1
;
TW
.
partialGraph
.
_core
.
graph
.
edgesIndex
[
e_id
].
color
=
"rgba("
+
[
r
,
g
,
b
].
join
(
","
)
+
",0.5)"
;
}
// [ / Edge-colour by source-target nodes-colours combination ]
set_ClustersLegend
(
null
)
TW
.
partialGraph
.
refresh
();
TW
.
partialGraph
.
draw
();
}
function
colorsBy
(
daclass
)
{
pr
(
""
)
...
...
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