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
9e4afff2
Commit
9e4afff2
authored
Apr 07, 2017
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix nodes(i) => nodes(id) and harmonize id names
parent
7a2cb67d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
53 additions
and
35 deletions
+53
-35
settings_explorerjs.js
settings_explorerjs.js
+8
-7
Tinaweb.js
tinawebJS/Tinaweb.js
+15
-8
enviroment.js
tinawebJS/enviroment.js
+2
-0
main.js
tinawebJS/main.js
+3
-2
methods.js
tinawebJS/methods.js
+15
-10
sigmaUtils.js
tinawebJS/sigmaUtils.js
+10
-8
No files found.
settings_explorerjs.js
View file @
9e4afff2
...
@@ -135,11 +135,12 @@ var sigmaJsDrawingProperties = {
...
@@ -135,11 +135,12 @@ var sigmaJsDrawingProperties = {
// twNodeRendBorderColor: "#eee",
// twNodeRendBorderColor: "#eee",
// font: "Crete Round",
// font: "Crete Round",
font
:
"Sahitya"
,
// font: "Sahitya",
// fontStyle: "bold",
};
};
var
sigmaJsGraphProperties
=
{
var
sigmaJsGraphProperties
=
{
minEdgeSize
:
2
,
minEdgeSize
:
1
,
maxEdgeSize
:
3
maxEdgeSize
:
5
};
};
var
sigmaJsMouseProperties
=
{
var
sigmaJsMouseProperties
=
{
minRatio
:
0.1
,
minRatio
:
0.1
,
...
@@ -221,10 +222,10 @@ var leftright=true;
...
@@ -221,10 +222,10 @@ var leftright=true;
var
edgesTF
=
false
;
var
edgesTF
=
false
;
//This variables will be updated in sigma.parseCustom.js
//This variables will be updated in sigma.parseCustom.js
var
minNodeSize
=
1
.
00
;
var
minNodeSize
=
1
00000
00
;
var
maxNodeSize
=
5.0
0
;
var
maxNodeSize
=
0
;
var
minEdgeWeight
=
5.0
;
// var minEdgeWeight=5.0; // in fact never used...
var
maxEdgeWeight
=
0.0
;
//
var maxEdgeWeight=0.0;
//---------------------------------------------------
//---------------------------------------------------
var
bipartite
=
false
;
var
bipartite
=
false
;
...
...
tinawebJS/Tinaweb.js
View file @
9e4afff2
...
@@ -186,22 +186,29 @@ function SelectionEngine() {
...
@@ -186,22 +186,29 @@ function SelectionEngine() {
}
}
}
}
for
(
var
i
in
nodes_2_colour
)
{
for
(
var
nid
in
nodes_2_colour
)
{
if
(
i
)
{
if
(
nid
)
{
n
=
TW
.
partialGraph
.
graph
.
nodes
(
i
)
n
=
TW
.
partialGraph
.
graph
.
nodes
(
nid
)
if
(
n
)
{
if
(
n
)
{
n
.
color
=
n
.
customAttrs
[
'true_color'
];
n
.
color
=
n
.
customAttrs
[
'true_color'
];
n
.
customAttrs
[
'grey'
]
=
0
;
n
.
customAttrs
[
'grey'
]
=
0
;
if
(
nodes_2_colour
[
i
])
{
if
(
nodes_2_colour
[
nid
])
{
n
.
active
=
nodes_2_colour
[
i
]
;
n
.
active
=
true
;
selections
[
i
]
=
1
selections
[
nid
]
=
1
}
}
}
}
}
}
}
}
for
(
var
i
in
edges_2_colour
)
{
console
.
log
(
'edges_2_colour'
,
edges_2_colour
)
let
an_edge
=
TW
.
partialGraph
.
graph
.
edges
(
i
)
for
(
var
eid
in
edges_2_colour
)
{
// console.log(eid)
let
an_edge
=
TW
.
partialGraph
.
graph
.
edges
(
eid
)
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
if
(
!
isUndef
(
an_edge
)
&&
!
an_edge
.
hidden
){
// /!\ £TODO change only *flags* here, and then
// make all color etc changes in renderers depending on flags
an_edge
.
color
=
an_edge
.
customAttrs
[
'true_color'
];
an_edge
.
color
=
an_edge
.
customAttrs
[
'true_color'
];
an_edge
.
customAttrs
[
'grey'
]
=
0
;
an_edge
.
customAttrs
[
'grey'
]
=
0
;
}
}
...
...
tinawebJS/enviroment.js
View file @
9e4afff2
...
@@ -623,6 +623,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
...
@@ -623,6 +623,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
return
;
return
;
}
}
// ids per weight level
// £TODO make this into a type_attrb index (eg weight index) instead of recalculating each time
// £TODO make this into a type_attrb index (eg weight index) instead of recalculating each time
var
filterparams
=
AlgorithmForSliders
(
TW
.
Nodes
,
type
,
type_attrb
,
criteria
)
var
filterparams
=
AlgorithmForSliders
(
TW
.
Nodes
,
type
,
type_attrb
,
criteria
)
// console.log("NodeWeightFilter: "+type)
// console.log("NodeWeightFilter: "+type)
...
@@ -630,6 +631,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
...
@@ -630,6 +631,7 @@ function NodeWeightFilter( categories , sliderDivID , type_attrb , type , crit
var
steps
=
filterparams
[
"steps"
]
var
steps
=
filterparams
[
"steps"
]
var
finalarray
=
filterparams
[
"finalarray"
]
var
finalarray
=
filterparams
[
"finalarray"
]
if
(
steps
<
3
)
{
if
(
steps
<
3
)
{
$
(
sliderDivID
).
freshslider
({
$
(
sliderDivID
).
freshslider
({
range
:
true
,
range
:
true
,
...
...
tinawebJS/main.js
View file @
9e4afff2
...
@@ -180,6 +180,8 @@ if(RES["OK"]) {
...
@@ -180,6 +180,8 @@ if(RES["OK"]) {
var
dicts
=
start
.
makeDicts
(
categories
);
var
dicts
=
start
.
makeDicts
(
categories
);
TW
.
Nodes
=
dicts
.
nodes
;
TW
.
Nodes
=
dicts
.
nodes
;
TW
.
Edges
=
dicts
.
edges
;
TW
.
Edges
=
dicts
.
edges
;
TW
.
nodeIds
=
Object
.
keys
(
dicts
.
nodes
)
// useful for loops
TW
.
edgeIds
=
Object
.
keys
(
dicts
.
edges
)
if
(
the_data
.
clusters
)
TW
.
Clusters
=
the_data
.
clusters
if
(
the_data
.
clusters
)
TW
.
Clusters
=
the_data
.
clusters
TW
.
nodes1
=
dicts
.
n1
;
//not used
TW
.
nodes1
=
dicts
.
n1
;
//not used
...
@@ -228,8 +230,7 @@ if(RES["OK"]) {
...
@@ -228,8 +230,7 @@ if(RES["OK"]) {
drawLabels
:
true
,
drawLabels
:
true
,
labelSize
:
"proportional"
,
labelSize
:
"proportional"
,
font
:
"Ubuntu Condensed"
,
// overridden by settings_explorer.js
// font: "Ubuntu Condensed", // overridden by settings_explorer.js
fontStyle
:
"bold"
,
// labelColor: "node",
// labelColor: "node",
// nodesPowRatio: .3,
// nodesPowRatio: .3,
...
...
tinawebJS/methods.js
View file @
9e4afff2
...
@@ -15,7 +15,7 @@ function cancelSelection (fromTagCloud) {
...
@@ -15,7 +15,7 @@ function cancelSelection (fromTagCloud) {
if
(
TW
.
partialGraph
.
settings
(
'drawEdges'
))
{
if
(
TW
.
partialGraph
.
settings
(
'drawEdges'
))
{
for
(
let
i
=
0
;
i
<
TW
.
nEdges
;
i
++
){
for
(
let
i
=
0
;
i
<
TW
.
nEdges
;
i
++
){
let
e
=
TW
.
partialGraph
.
graph
.
edges
(
i
)
let
e
=
TW
.
partialGraph
.
graph
.
edges
(
TW
.
edgeIds
[
i
]
)
// console.log("cancelSelection: edge", e)
// console.log("cancelSelection: edge", e)
if
(
e
)
{
if
(
e
)
{
e
.
color
=
e
.
customAttrs
[
'grey'
]
?
e
.
customAttrs
[
'true_color'
]
:
e
.
color
;
e
.
color
=
e
.
customAttrs
[
'grey'
]
?
e
.
customAttrs
[
'true_color'
]
:
e
.
color
;
...
@@ -26,7 +26,7 @@ function cancelSelection (fromTagCloud) {
...
@@ -26,7 +26,7 @@ function cancelSelection (fromTagCloud) {
//Nodes colors go back to normal
//Nodes colors go back to normal
for
(
let
j
=
0
;
j
<
TW
.
nNodes
;
j
++
){
for
(
let
j
=
0
;
j
<
TW
.
nNodes
;
j
++
){
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
j
)
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
TW
.
nodeIds
[
j
]
)
// console.log("cancelSelection: node", n)
// console.log("cancelSelection: node", n)
if
(
n
)
{
if
(
n
)
{
n
.
active
=
false
;
n
.
active
=
false
;
...
@@ -52,11 +52,14 @@ function cancelSelection (fromTagCloud) {
...
@@ -52,11 +52,14 @@ function cancelSelection (fromTagCloud) {
$
(
'#searchinput'
).
trigger
(
"tw:eraseNodeSet"
);
$
(
'#searchinput'
).
trigger
(
"tw:eraseNodeSet"
);
// (signal for plugins that any selection behavior is finished)
// (signal for plugins that any selection behavior is finished)
for
(
var
i
in
deselections
){
for
(
var
nid
in
deselections
){
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
i
)
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
nid
)
if
(
!
isUndef
(
n
)
)
{
if
(
!
isUndef
(
n
)
)
{
n
.
forceLabel
=
false
;
n
.
forceLabel
=
false
;
n
.
neighbour
=
false
;
n
.
neighbour
=
false
;
// like old graphResetColor but now rather graphResetFlags...
n
.
active
=
false
;
n
.
grey
=
false
}
}
}
}
...
@@ -544,22 +547,24 @@ function graphTagCloudElem(nodes) {
...
@@ -544,22 +547,24 @@ function graphTagCloudElem(nodes) {
}
}
// new sigma.js: is this at all used?
// /!\ £TODO change only *flags* here, and then
// make all color etc changes in renderers depending on flags
function
greyEverything
(){
function
greyEverything
(){
for
(
let
j
=
0
;
j
<
TW
.
n
Edg
es
;
j
++
){
for
(
let
j
=
0
;
j
<
TW
.
n
Nod
es
;
j
++
){
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
j
)
let
n
=
TW
.
partialGraph
.
graph
.
nodes
(
TW
.
nodeIds
[
j
]
)
if
(
n
&&
!
n
.
hidden
&&
!
n
.
customAttrs
.
grey
)
{
if
(
n
&&
!
n
.
hidden
&&
!
n
.
customAttrs
.
grey
)
{
n
.
customAttrs
.
true_color
=
n
.
color
n
.
customAttrs
.
true_color
=
n
.
color
// TODO check if no simpler strategy than reinvoke hex2rga each time
// TODO check if no simpler strategy than reinvoke hex2rga each time
n
.
color
=
"rgba("
+
hex2rga
(
n
.
color
)
+
",0.5)"
// n.color = "rgba("+hex2rga(n.color)+",0.5)"
n
.
color
=
"rgba(15,15,15,0.5)"
n
.
customAttrs
[
'grey'
]
=
1
n
.
customAttrs
[
'grey'
]
=
1
}
}
}
}
if
(
TW
.
partialGraph
.
settings
(
'drawEdges'
))
{
if
(
TW
.
partialGraph
.
settings
(
'drawEdges'
))
{
for
(
let
i
=
0
;
i
<
TW
.
nEdges
;
i
++
){
for
(
let
i
=
0
;
i
<
TW
.
nEdges
;
i
++
){
let
e
=
TW
.
partialGraph
.
graph
.
edges
(
i
)
let
e
=
TW
.
partialGraph
.
graph
.
edges
(
TW
.
edgeIds
[
i
]
)
if
(
e
&&
!
e
.
hidden
&&
!
e
.
customAttrs
.
grey
)
{
if
(
e
&&
!
e
.
hidden
&&
!
e
.
customAttrs
.
grey
)
{
e
.
customAttrs
.
true_color
=
e
.
color
e
.
customAttrs
.
true_color
=
e
.
color
e
.
color
=
TW
.
edgeGreyColor
e
.
color
=
TW
.
edgeGreyColor
...
@@ -570,7 +575,7 @@ function greyEverything(){
...
@@ -570,7 +575,7 @@ function greyEverything(){
}
}
// new sigma.js:
is this at all used?
// new sigma.js:
TODO change logic (the reverse of greyEverything is done by redraw for the colors, and cancelSelection for the flags...)
// function graphResetColor(){
// function graphResetColor(){
// nds = TW.partialGraph.graph.nodes().filter(function(x) {
// nds = TW.partialGraph.graph.nodes().filter(function(x) {
// return !x['hidden'];
// return !x['hidden'];
...
...
tinawebJS/sigmaUtils.js
View file @
9e4afff2
...
@@ -442,7 +442,8 @@ SigmaUtils = function () {
...
@@ -442,7 +442,8 @@ SigmaUtils = function () {
// (TODO REFA make them inside TW.- ns)
// (TODO REFA make them inside TW.- ns)
// not often necessary, use TW.partialGraph.graph.nodes(j) as accessor
// not often necessary + costly in mem because is a clone
// => preferably use TW.partialGraph.graph.nodes(some_node_id) as accessor
function
getnodes
(){
function
getnodes
(){
// new sigma.js
// new sigma.js
return
TW
.
partialGraph
.
graph
.
nodes
();
return
TW
.
partialGraph
.
graph
.
nodes
();
...
@@ -582,6 +583,8 @@ function getArrSubkeys(arr,id) {
...
@@ -582,6 +583,8 @@ function getArrSubkeys(arr,id) {
function
clustersBy
(
daclass
)
{
function
clustersBy
(
daclass
)
{
cancelSelection
(
false
);
cancelSelection
(
false
);
// TODO avoid this strategy and also double loop below
var
v_nodes
=
getVisibleNodes
();
var
v_nodes
=
getVisibleNodes
();
var
min_pow
=
0
;
var
min_pow
=
0
;
for
(
var
i
in
v_nodes
)
{
for
(
var
i
in
v_nodes
)
{
...
@@ -629,17 +632,16 @@ function clustersBy(daclass) {
...
@@ -629,17 +632,16 @@ function clustersBy(daclass) {
var
Max_color
=
255
;
var
Max_color
=
255
;
var
Min_size
=
2
;
var
Min_size
=
2
;
var
Max_size
=
6
;
var
Max_size
=
6
;
for
(
var
i
in
NodeID_Val
)
{
for
(
var
nid
in
NodeID_Val
)
{
var
newval_color
=
Math
.
round
(
(
Min_color
+
(
NodeID_Val
[
nid
][
"round"
]
-
real_min
)
*
((
Max_color
-
Min_color
)
/
(
real_max
-
real_min
))
)
);
var
newval_color
=
Math
.
round
(
(
Min_color
+
(
NodeID_Val
[
i
][
"round"
]
-
real_min
)
*
((
Max_color
-
Min_color
)
/
(
real_max
-
real_min
))
)
);
var
hex_color
=
rgbToHex
(
255
,
(
255
-
newval_color
)
,
0
)
var
hex_color
=
rgbToHex
(
255
,
(
255
-
newval_color
)
,
0
)
TW
.
partialGraph
.
graph
.
nodes
(
i
).
color
=
hex_color
TW
.
partialGraph
.
graph
.
nodes
(
nid
).
color
=
hex_color
var
newval_size
=
Math
.
round
(
(
Min_size
+
(
NodeID_Val
[
i
][
"round"
]
-
real_min
)
*
((
Max_size
-
Min_size
)
/
(
real_max
-
real_min
))
)
);
var
newval_size
=
Math
.
round
(
(
Min_size
+
(
NodeID_Val
[
nid
][
"round"
]
-
real_min
)
*
((
Max_size
-
Min_size
)
/
(
real_max
-
real_min
))
)
);
TW
.
partialGraph
.
graph
.
nodes
(
i
).
size
=
newval_size
;
TW
.
partialGraph
.
graph
.
nodes
(
nid
).
size
=
newval_size
;
// console.log("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
// console.log("real:"+ NodeID_Val[i]["real"] + " | newvalue: "+newval_size)
TW
.
partialGraph
.
graph
.
nodes
(
i
).
label
=
"("
+
NodeID_Val
[
i
][
"real"
].
toFixed
(
min_pow
)
+
") "
+
TW
.
Nodes
[
i
].
label
TW
.
partialGraph
.
graph
.
nodes
(
nid
).
label
=
"("
+
NodeID_Val
[
nid
][
"real"
].
toFixed
(
min_pow
)
+
") "
+
TW
.
Nodes
[
nid
].
label
}
}
// [ / Scaling node colours(0-255) and sizes(3-5) ]
// [ / Scaling node colours(0-255) and sizes(3-5) ]
...
...
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