Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
gargantext
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
58734474
Commit
58734474
authored
Oct 05, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
last fix for graph
parent
eb8157ef
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
19 deletions
+117
-19
NGrams_dyna_chart_and_table.js
static/lib/gargantext/NGrams_dyna_chart_and_table.js
+3
-1
myGraphs.html
templates/pages/corpora/myGraphs.html
+114
-18
No files found.
static/lib/gargantext/NGrams_dyna_chart_and_table.js
View file @
58734474
...
...
@@ -2367,7 +2367,9 @@ function MainTableAndCharts( ngdata , initial , filtersParams, callerLabel) {
// restore chart filters
if
(
typeof
(
filtersParams
.
from
)
!=
'undefined'
&&
typeof
(
filtersParams
.
to
)
!=
'undefined'
)
{
&&
typeof
(
filtersParams
.
to
)
!=
'undefined'
&&
!
(
filtersParams
.
from
==
null
)
&&
!
(
filtersParams
.
to
==
null
))
{
var
fromVal
=
filtersParams
.
from
var
toVal
=
filtersParams
.
to
...
...
templates/pages/corpora/myGraphs.html
View file @
58734474
...
...
@@ -213,7 +213,7 @@
</div>
\
</div>'
var
finishedHtml
Template
=
'
\
var
finishedHtml
Condi
=
'
\
<br>
\
From: begin of corpus
\
, To: end of corpus
\
...
...
@@ -222,8 +222,8 @@
<li>
\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&distance=conditional&bridgeness=5">
\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>
\
~%%nb_nodes%% nodes,
\
~%%nb_edges%% edges
\
~%%
co_
nb_nodes%% nodes,
\
~%%
co_
nb_edges%% edges
\
with <b>Conditional</b> distance
\
</a>
\
</li>
\
...
...
@@ -236,6 +236,54 @@
</ul>
\
<br>'
var
finishedHtmlDistri
=
'
\
<br>
\
From: begin of corpus
\
, To: end of corpus
\
<br>
\
<ul id="graph_%%cooc_id%%_finished">
\
<li>
\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&distance=conditional&bridgeness=5">
\
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
\
Compute this graph with Conditional distance
\
</a>
\
</li>
\
<li>
\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&distance=conditional&bridgeness=5">
\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>
\
~%%di_nb_nodes%% nodes,
\
~%%di_nb_edges%% edges
\
with <b>Distributional</b> distance
\
</a>
\
</li>
\
</ul>
\
<br>'
var
finishedHtmlTemplate
=
'
\
<br>
\
From: begin of corpus
\
, To: end of corpus
\
<br>
\
<ul id="graph_%%cooc_id%%_finished">
\
<li>
\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&distance=conditional&bridgeness=5">
\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>
\
~%%co_nb_nodes%% nodes,
\
~%%co_nb_edges%% edges
\
with <b>Conditional</b> distance
\
</a>
\
</li>
\
<li>
\
<a href="/projects/%%project_id%%/corpora/%%corpus_id%%/explorer?cooc_id=%%cooc_id%%&distance=distributional&bridgeness=5">
\
<span class="glyphicon glyphicon-eye-open" style="font-size:150%"></span>
\
~%%di_nb_nodes%% nodes,
\
~%%di_nb_edges%% edges
\
with <b>Distributional</b> distance
\
</a>
\
</li>
\
</ul>
\
<br>'
var
baseSkeletonTemplate
=
'
\
<div id="graph_%%cooc_id%%" class="graph-elt first-graph">
\
<div class="row">
\
...
...
@@ -295,12 +343,15 @@
* @param coocId
* @param coocName
* @param coocDate
* @param nNodes (optional <=> if finished_status)
* @param nEdges (optional <=> if finished_status)
* @param coNbNodes (optional <=> if finished_status on conditional)
* @param coNbEdges (optional <=> if finished_status on conditional)
* @param diNbNodes (optional <=> if finished_status on distributional)
* @param diNbEdges (optional <=> if finished_status on distributional)
*/
function
showNewCoocDiv
(
statusCode
,
coocId
,
coocName
,
coocDate
,
nbNodes
,
nbEdges
)
{
coNbNodes
,
coNbEdges
,
diNbNodes
,
diNbEdges
)
{
var
resultHtml
=
baseSkeletonTemplate
// initial if
...
...
@@ -312,9 +363,22 @@
break
;
case
"finished_status"
:
resultHtml
=
resultHtml
.
replace
(
/%%HERE_RESPONSE_DEPENDANT%%/
,
finishedHtmlTemplate
)
if
((
typeof
coNbNodes
!=
'undefined'
)
&&
coNbNodes
&&
(
typeof
diNbNodes
!=
'undefined'
)
&&
diNbNodes
)
{
resultHtml
=
resultHtml
.
replace
(
/%%HERE_RESPONSE_DEPENDANT%%/
,
finishedHtmlTemplate
)
}
else
if
((
typeof
coNbNodes
!=
'undefined'
)
&&
!
(
coNbNodes
==
null
))
{
console
.
log
(
"condi case"
,
coNbNodes
)
resultHtml
=
resultHtml
.
replace
(
/%%HERE_RESPONSE_DEPENDANT%%/
,
finishedHtmlCondi
)
}
else
if
((
typeof
diNbNodes
!=
'undefined'
)
&&
!
(
diNbNodes
==
null
))
{
console
.
log
(
"distri case"
)
resultHtml
=
resultHtml
.
replace
(
/%%HERE_RESPONSE_DEPENDANT%%/
,
finishedHtmlDistri
)
}
break
;
default
:
...
...
@@ -330,9 +394,13 @@
resultHtml
=
resultHtml
.
replace
(
/%%cooc_name%%/g
,
coocName
);
resultHtml
=
resultHtml
.
replace
(
/%%cooc_date%%/g
,
formatDateLikeDjango
(
coocDate
));
if
(
typeof
nbEdges
!=
'undefined'
&&
typeof
nbNodes
!=
'undefined'
)
{
resultHtml
=
resultHtml
.
replace
(
/%%nb_nodes%%/g
,
nbNodes
);
resultHtml
=
resultHtml
.
replace
(
/%%nb_edges%%/g
,
nbEdges
);
if
(
typeof
coNbEdges
!=
'undefined'
&&
typeof
coNbNodes
!=
'undefined'
)
{
resultHtml
=
resultHtml
.
replace
(
/%%co_nb_nodes%%/g
,
coNbNodes
);
resultHtml
=
resultHtml
.
replace
(
/%%co_nb_edges%%/g
,
coNbEdges
);
}
if
(
typeof
diNbEdges
!=
'undefined'
&&
typeof
diNbNodes
!=
'undefined'
)
{
resultHtml
=
resultHtml
.
replace
(
/%%di_nb_nodes%%/g
,
diNbNodes
);
resultHtml
=
resultHtml
.
replace
(
/%%di_nb_edges%%/g
,
diNbEdges
);
}
// what do we do with those results ?
...
...
@@ -366,8 +434,8 @@
var
coocId
=
null
// 1 & 2
var
coocName
=
null
// 1 & 2
var
coocDate
=
null
// 1 & 2
var
n
bNodes
=
null
// 2
var
n
bEdges
=
null
// 2
var
coN
bNodes
=
null
// 2
var
coN
bEdges
=
null
// 2
// run the "save new graph" ajax
// -----------------------------
...
...
@@ -439,17 +507,45 @@
var
coocNodeDate
=
data
[
'date'
]
// test if ready like this for the moment
if
(
typeof
data
[
'hyperdata'
][
'conditional'
]
!=
"undefined"
)
{
if
((
typeof
data
[
'hyperdata'
][
'conditional'
]
!=
"undefined"
)
&&
(
typeof
data
[
'hyperdata'
][
'distributional'
]
!=
"undefined"
)){
console
.
log
(
"GRAPH is READY"
,
coocNodeId
)
graphReadyFlag
=
true
var
nbNodes
=
data
[
'hyperdata'
][
'conditional'
][
'nodes'
]
var
nbEdges
=
data
[
'hyperdata'
][
'conditional'
][
'edges'
]
var
coNbNodes
=
data
[
'hyperdata'
][
'conditional'
][
'nodes'
]
var
coNbEdges
=
data
[
'hyperdata'
][
'conditional'
][
'edges'
]
var
diNbNodes
=
data
[
'hyperdata'
][
'distributional'
][
'nodes'
]
var
diNbEdges
=
data
[
'hyperdata'
][
'distributional'
][
'edges'
]
// console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv
(
"finished_status"
,
coocNodeId
,
coocNodeName
,
coocNodeDate
,
nbNodes
,
nbEdges
)
coNbNodes
,
coNbEdges
,
diNbNodes
,
diNbEdges
)
}
else
if
(
typeof
data
[
'hyperdata'
][
'conditional'
]
!=
"undefined"
){
console
.
log
(
"conditional GRAPH is READY"
,
coocNodeId
)
graphReadyFlag
=
true
var
coNbNodes
=
data
[
'hyperdata'
][
'conditional'
][
'nodes'
]
var
coNbEdges
=
data
[
'hyperdata'
][
'conditional'
][
'edges'
]
// console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv
(
"finished_status"
,
coocNodeId
,
coocNodeName
,
coocNodeDate
,
coNbNodes
,
coNbEdges
,
null
,
null
)
}
else
if
(
typeof
data
[
'hyperdata'
][
'distributional'
]
!=
"undefined"
){
console
.
log
(
"distributional GRAPH is READY"
,
coocNodeId
)
graphReadyFlag
=
true
var
diNbNodes
=
data
[
'hyperdata'
][
'distributional'
][
'nodes'
]
var
diNbEdges
=
data
[
'hyperdata'
][
'distributional'
][
'edges'
]
// console.warn("running callback for graph id:" + coocNodeId)
showNewCoocDiv
(
"finished_status"
,
coocNodeId
,
coocNodeName
,
coocNodeDate
,
null
,
null
,
diNbNodes
,
diNbEdges
)
}
// stopping conditions
...
...
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