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
7b5ba7fa
Commit
7b5ba7fa
authored
Sep 22, 2014
by
PkSM3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FA2 bipartite independent layouting and Bugfix:DisableLevelButt
parent
b5307731
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
416 deletions
+70
-416
enviroment.js
tinawebJS/js/enviroment.js
+8
-231
main.js
tinawebJS/js/main.js
+1
-1
methods.js
tinawebJS/js/methods.js
+19
-164
sigma.forceatlas2.js
tinawebJS/js/sigma.forceatlas2.js
+42
-20
No files found.
tinawebJS/js/enviroment.js
View file @
7b5ba7fa
This diff is collapsed.
Click to expand it.
tinawebJS/js/main.js
View file @
7b5ba7fa
...
...
@@ -525,7 +525,7 @@ function theListeners(){
else
{
if
(
!
is_empty
(
selections
)){
cancelSelection
(
false
);
LevelButtonDisable
(
true
);
//
LevelButtonDisable(true);
}
}
});
...
...
tinawebJS/js/methods.js
View file @
7b5ba7fa
...
...
@@ -142,7 +142,7 @@ function cancelSelection (fromTagCloud) {
n
.
attr
[
'grey'
]
=
0
;
}).
draw
(
2
,
1
,
2
);
//Nodes colors go back to normal
changeButton
(
"unselectNodes"
);
if
(
fromTagCloud
==
false
){
$
(
"#names"
).
html
(
""
);
...
...
@@ -212,12 +212,12 @@ function RefreshState(newNOW){
}
}
i
=
0
;
for
(
var
s
in
selections
)
{
i
++
;
break
;}
if
(
is_empty
(
selections
)
||
i
==
0
)
LevelButtonDisable
(
true
);
else
LevelButtonDisable
(
false
);
//
i=0; for(var s in selections) { i++; break;}
//
if(is_empty(selections) || i==0) LevelButtonDisable(true);
//
else LevelButtonDisable(false);
//complete graphs case
sels
=
getNodeIDs
(
selections
).
length
//
sels=getNodeIDs(selections).length
if
(
NOW
==
"A"
||
NOW
==
"a"
)
{
// N : number of nodes
// k : number of ( selected nodes + their neighbors )
...
...
@@ -232,6 +232,12 @@ function RefreshState(newNOW){
}
else
LevelButtonDisable
(
false
);
if
(
s
==
N
)
LevelButtonDisable
(
false
);
}
if
(
NOW
==
"a"
)
{
i
=
0
;
for
(
var
s
in
selections
)
{
i
++
;
break
;}
if
(
is_empty
(
selections
)
||
i
==
0
)
LevelButtonDisable
(
false
);
}
EdgeWeightFilter
(
"#sliderAEdgeWeight"
,
"label"
,
"nodes1"
,
"weight"
);
$
(
"#colorGraph"
).
show
();
...
...
@@ -247,6 +253,13 @@ function RefreshState(newNOW){
}
else
LevelButtonDisable
(
false
);
if
(
s
==
N
)
LevelButtonDisable
(
false
);
}
if
(
NOW
==
"b"
)
{
i
=
0
;
for
(
var
s
in
selections
)
{
i
++
;
break
;}
if
(
is_empty
(
selections
)
||
i
==
0
)
LevelButtonDisable
(
false
);
}
EdgeWeightFilter
(
"#sliderBEdgeWeight"
,
"label"
,
"nodes2"
,
"weight"
);
NodeWeightFilter
(
"#sliderBNodeWeight"
,
"type"
,
"NGram"
,
"size"
)
$
(
"#colorGraph"
).
hide
();
...
...
@@ -576,60 +589,6 @@ function graphTagCloudElem(node_id){
changeLevel
();
}
//obsolete
function
graphDocs
(
node_id
){
pr
(
"
\
tin graphDocs, node_id: "
+
node_id
);
fullurl
=
returnBaseUrl
()
+
"img/trans/"
;
document
.
getElementById
(
"viewType"
).
src
=
fullurl
+
"status_meso_view.png"
;
document
.
getElementById
(
"socio"
).
src
=
fullurl
+
"active_scholars.png"
;
document
.
getElementById
(
"semantic"
).
src
=
fullurl
+
"inactive_tags.png"
;
document
.
getElementById
(
"sociosemantic"
).
src
=
fullurl
+
"inactive_sociosem.png"
;
document
.
getElementById
(
"switch"
).
src
=
fullurl
+
"graph_macro.png"
;
hideEverything
()
//partialGraph.stopForceAtlas2();
if
(
Nodes
[
node_id
].
type
==
catSoc
)
{
labels
=
[];
unHide
(
node_id
);
for
(
i
=
0
;
i
<
nodes1
[
node_id
].
neighbours
.
length
;
i
++
)
{
unHide
(
nodes1
[
node_id
].
neighbours
[
i
]);
}
existingNodes
=
partialGraph
.
_core
.
graph
.
nodes
.
filter
(
function
(
n
)
{
return
!
n
[
'hidden'
];
});
for
(
i
=
0
;
i
<
existingNodes
.
length
;
i
++
){
if
(
existingNodes
[
i
].
id
==
node_id
)
i
++
;
for
(
j
=
0
;
j
<
existingNodes
.
length
;
j
++
){
i1
=
existingNodes
[
i
].
id
+
";"
+
existingNodes
[
j
].
id
;
i2
=
existingNodes
[
j
].
id
+
";"
+
existingNodes
[
i
].
id
;
if
(
!
isUndef
(
Edges
[
i1
])
&&
!
isUndef
(
Edges
[
i2
])){
if
(
Edges
[
i1
].
weight
>
Edges
[
i2
].
weight
){
unHide
(
i1
);
}
if
(
Edges
[
i1
].
weight
<
Edges
[
i2
].
weight
){
unHide
(
i2
);
}
if
(
Edges
[
i1
].
weight
==
Edges
[
i2
].
weight
){
unHide
(
i1
);
}
}
}
}
node
=
partialGraph
.
_core
.
graph
.
nodesIndex
[
node_id
];
selection
(
node
);
$
(
"#category-A"
).
show
();
$
(
"#category-B"
).
hide
();
changeButton
(
"active_scholars.png"
);
}
}
function
updateDownNodeEvent
(
selectionRadius
){
pr
(
"actualizando eventos downode"
);
partialGraph
.
unbind
(
"downnodes"
);
...
...
@@ -1205,50 +1164,6 @@ function hoverNodeEffectWhileFA2(selectionRadius) {
// getOpossitesNodes(nodeID, false);//passing just the node-id
}
}
// if(cursor_size>0 &&){
// //The click WAS in a node and the cursor_size is ON
// //if(checkBox==false) cancelSelection(false);
// x1 = partialGraph._core.mousecaptor.mouseX;
// y1 = partialGraph._core.mousecaptor.mouseY;
// //dist1(centerClick,selectionRadius)
// partialGraph.iterNodes(function(n){
// if(n.hidden==false){
// distance = Math.sqrt(
// Math.pow((x1-parseInt(n.displayX)),2) +
// Math.pow((y1-parseInt(n.displayY)),2)
// );
// if(parseInt(distance)<=cursor_size) {
// getOpossitesNodes(n,true);//passing the entire node
// }
// }
// });
// }
// if(categoriesIndex.length==1) updateLeftPanel_uni();
// if(categoriesIndex.length==2) updateLeftPanel_fix();
// //The most brilliant way of knowing if an array is empty in the world of JavaScript
// i=0; for(var s in selections) {i++;break};
// if(is_empty(selections) || i==0){
// pr("cursor radius ON, downNode -> selecciones vacias");
// $("#names").html(""); //Information extracted, just added
// $("#opossiteNodes").html(""); //Information extracted, just added
// $("#information").html("");
// $("#tips").html(getTips());
// $("#topPapers").html(""); $("#topPapers").hide();
// changeButton("unselectNodes");
// //cancelSelection(false);
// graphResetColor();
// }
// else {
// greyEverything();
// for(var i in selections){
// markAsSelected(i,true);
// }
// RefreshState("")
// }
// overNodes=true;
// partialGraph.draw();
});
}
...
...
@@ -1705,35 +1620,6 @@ function highlightOpossites (list){/*here*/
}
}
function
selectOpossites
(
list
){
//Expanding selection
cancelSelection
(
false
);
checkBox
=
true
;
for
(
var
n
in
list
){
getOpossitesNodes
(
n
,
false
);
}
updateLeftPanel_fix
();
i
=
0
;
for
(
var
s
in
selections
)
i
++
;
if
(
is_empty
(
selections
)
==
true
||
i
==
0
){
$
(
"#names"
).
html
(
""
);
//Information extracted, just added
$
(
"#opossiteNodes"
).
html
(
""
);
//Information extracted, just added
$
(
"#information"
).
html
(
""
);
$
(
"#topPapers"
).
html
(
""
);
$
(
"#topPapers"
).
hide
();
$
(
"#tips"
).
html
(
getTips
());
changeButton
(
"unselectNodes"
);
cancelSelection
(
false
);
}
else
{
greyEverything
();
for
(
var
i
in
list
){
markAsSelected
(
i
,
true
);
}
changeButton
(
"selectNode"
);
}
overNodes
=
true
;
checkBox
=
false
;
partialGraph
.
draw
();
}
function
getByID
(
elem
)
{
return
document
.
getElementById
(
elem
);
}
...
...
@@ -1826,37 +1712,6 @@ function saveGraphIMG(){
document
.
location
.
href
=
strData
.
replace
(
"image/png"
,
strDownloadMime
)
}
//to erase
function
testSave
(){
var
strDownloadMime
=
"image/octet-stream"
var
nodesDiv
=
partialGraph
.
_core
.
domElements
.
nodes
;
var
nodesCtx
=
nodesDiv
.
getContext
(
"2d"
);
var
edgesDiv
=
partialGraph
.
_core
.
domElements
.
edges
;
var
edgesCtx
=
edgesDiv
.
getContext
(
"2d"
);
var
labelsDiv
=
partialGraph
.
_core
.
domElements
.
labels
;
var
labelsCtx
=
labelsDiv
.
getContext
(
"2d"
);
nodesCtx
.
drawImage
(
labelsDiv
,
0
,
0
);
edgesCtx
.
drawImage
(
nodesDiv
,
0
,
0
);
var
strData
=
edgesDiv
.
toDataURL
(
"image/png"
);
pr
(
strData
)
// document.location.href = strData.replace("image/png", strDownloadMime)
}
//obsolete
function
getSwitchButton
(){
return
document
.
getElementById
(
"switchbutton"
).
src
;
}
//obsolete
function
setComponentButton
(
comp_name
){
document
.
getElementById
(
comp_name
);
...
...
tinawebJS/js/sigma.forceatlas2.js
View file @
7b5ba7fa
...
...
@@ -43,6 +43,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
self
.
graph
.
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
n
.
fa2
=
{
mass
:
1
+
n
.
degree
,
old_dx
:
0
,
...
...
@@ -51,6 +53,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
dy
:
0
};
}
});
return
self
;
...
...
@@ -74,6 +78,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
self
.
count
++
;
nodes
.
forEach
(
function
(
n
)
{
if
(
n
.
degree
>
0
)
{
if
(
n
.
fa2
)
{
n
.
fa2
.
mass
=
1
+
n
.
degree
;
n
.
fa2
.
old_dx
=
n
.
fa2
.
dx
;
...
...
@@ -90,6 +96,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
};
}
}
});
// If Barnes Hut active, initialize root region
...
...
@@ -102,7 +110,9 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
if
(
self
.
p
.
outboundAttractionDistribution
)
{
self
.
p
.
outboundAttCompensation
=
0
;
nodes
.
forEach
(
function
(
n
)
{
if
(
!
n
.
hidden
&&
n
.
degree
>
0
)
{
self
.
p
.
outboundAttCompensation
+=
n
.
fa2
.
mass
;
}
});
self
.
p
.
outboundAttCompensation
/=
nodes
.
length
;
}
...
...
@@ -125,7 +135,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var
i
=
self
.
state
.
index
;
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
cInt
)
{
var
n
=
nodes
[
i
++
];
if
(
n
.
fa2
)
if
(
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
rootRegion
.
applyForce
(
n
,
Repulsion
,
barnesHutTheta
);
}
if
(
i
==
nodes
.
length
)
{
...
...
@@ -138,9 +148,9 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var
i1
=
self
.
state
.
index
;
while
(
i1
<
nodes
.
length
&&
i1
<
self
.
state
.
index
+
cInt
)
{
var
n1
=
nodes
[
i1
++
];
if
(
n1
.
fa2
)
if
(
!
n1
.
hidden
&&
n1
.
degree
>
0
&&
n1
.
fa2
)
nodes
.
forEach
(
function
(
n2
,
i2
)
{
if
(
i2
<
i1
&&
n2
.
fa2
)
{
if
(
i2
<
i1
&&
(
!
n2
.
hidden
&&
n2
.
degree
>
0
&&
n2
.
fa2
)
)
{
Repulsion
.
apply_nn
(
n1
,
n2
);
}
});
...
...
@@ -171,7 +181,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
var
i
=
self
.
state
.
index
;
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
sInt
)
{
var
n
=
nodes
[
i
++
];
if
(
n
.
fa2
)
if
(
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
Gravity
.
apply_g
(
n
,
gravity
/
scalingRatio
);
}
...
...
@@ -198,22 +208,28 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
if
(
self
.
p
.
edgeWeightInfluence
==
0
)
{
while
(
i
<
edges
.
length
&&
i
<
self
.
state
.
index
+
cInt
)
{
var
e
=
edges
[
i
++
];
if
(
!
e
.
hidden
)
{
Attraction
.
apply_nn
(
e
.
source
,
e
.
target
,
1
);
}
}
}
else
if
(
self
.
p
.
edgeWeightInfluence
==
1
)
{
while
(
i
<
edges
.
length
&&
i
<
self
.
state
.
index
+
cInt
)
{
var
e
=
edges
[
i
++
];
if
(
!
e
.
hidden
)
{
Attraction
.
apply_nn
(
e
.
source
,
e
.
target
,
e
.
weight
||
1
);
}
}
}
else
{
while
(
i
<
edges
.
length
&&
i
<
self
.
state
.
index
+
cInt
)
{
var
e
=
edges
[
i
++
];
if
(
!
e
.
hidden
)
{
Attraction
.
apply_nn
(
e
.
source
,
e
.
target
,
Math
.
pow
(
e
.
weight
||
1
,
self
.
p
.
edgeWeightInfluence
)
);
}
}
}
if
(
i
==
edges
.
length
)
{
self
.
state
.
step
=
4
;
...
...
@@ -233,7 +249,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
nodes
.
forEach
(
function
(
n
)
{
var
fixed
=
n
.
fixed
||
false
;
if
(
!
fixed
&&
n
.
fa2
)
{
if
(
!
fixed
&&
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
{
var
swinging
=
Math
.
sqrt
(
Math
.
pow
(
n
.
fa2
.
old_dx
-
n
.
fa2
.
dx
,
2
)
+
Math
.
pow
(
n
.
fa2
.
old_dy
-
n
.
fa2
.
dy
,
2
));
...
...
@@ -285,8 +301,10 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
// Save old coordinates
nodes
.
forEach
(
function
(
n
)
{
if
(
!
n
.
hidden
&&
n
.
degree
>
0
)
{
n
.
old_x
=
+
n
.
x
;
n
.
old_y
=
+
n
.
y
;
}
});
self
.
state
.
step
=
5
;
...
...
@@ -302,7 +320,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
sInt
)
{
var
n
=
nodes
[
i
++
];
var
fixed
=
n
.
fixed
||
false
;
if
(
!
fixed
&&
n
.
fa2
)
{
if
(
!
fixed
&&
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
{
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
var
swinging
=
Math
.
sqrt
(
...
...
@@ -327,7 +345,7 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
while
(
i
<
nodes
.
length
&&
i
<
self
.
state
.
index
+
sInt
)
{
var
n
=
nodes
[
i
++
];
var
fixed
=
n
.
fixed
||
false
;
if
(
!
fixed
&&
n
.
fa2
)
{
if
(
!
fixed
&&
!
n
.
hidden
&&
n
.
degree
>
0
&&
n
.
fa2
)
{
// Adaptive auto-speed: the speed of each node is lowered
// when the node swings.
var
swinging
=
Math
.
sqrt
(
...
...
@@ -364,6 +382,8 @@ sigma.forceatlas2.ForceAtlas2 = function(graph , V , E) {
this
.
graph
.
nodes
.
forEach
(
function
(
n
)
{
n
.
fa2
=
null
;
});
pr
(
"#nodes: "
+
V
);
pr
(
"#edges: "
+
E
);
}
// Auto Settings
...
...
@@ -997,7 +1017,9 @@ sigma.publicPrototype.startForceAtlas2 = function() {
for
(
var
i
in
this
.
_core
.
graph
.
nodesIndex
)
{
// if(this._core.graph.nodesIndex[i].degree==0)
if
(
this
.
_core
.
graph
.
nodesIndex
[
i
].
degree
==
0
)
{
this
.
_core
.
graph
.
nodesIndex
[
i
].
color
=
"#000000"
}
// this._core.graph.nodesIndex[i].hidden = true;
pr
(
i
+
" -> "
+
this
.
_core
.
graph
.
nodesIndex
[
i
].
degree
)
}
...
...
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