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
89c93f35
Commit
89c93f35
authored
Feb 23, 2016
by
Mathieu Rodic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BUG] graphs are now working properly on corpus view
parent
8a12394b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
27 deletions
+34
-27
nodes.py
gargantext/views/api/nodes.py
+4
-1
Docs_dyna_chart_and_table.js
static/js/gargantext/Docs_dyna_chart_and_table.js
+30
-26
No files found.
gargantext/views/api/nodes.py
View file @
89c93f35
...
...
@@ -37,8 +37,11 @@ class NodesList(APIView):
# filter by parent
if
'parent_id'
in
parameters
:
query
=
query
.
filter
(
Node
.
parent_id
==
parameters
[
'parent_id'
])
#
paginate the query
#
count
count
=
query
.
count
()
# order
query
=
query
.
order_by
(
Node
.
hyperdata
[
'publication_date'
],
Node
.
id
)
# paginate the query
if
parameters
[
'pagination_limit'
]
==
-
1
:
query
=
query
[
parameters
[
'pagination_offset'
]:]
else
:
...
...
static/js/gargantext/Docs_dyna_chart_and_table.js
View file @
89c93f35
function
get_node_date
(
node
)
{
var
hyperdata
=
node
.
hyperdata
;
return
new
Date
(
Number
(
hyperdata
.
publication_year
),
Number
(
hyperdata
.
publication_month
)
-
1
,
Number
(
hyperdata
.
publication_day
)
);
};
function
pr
(
msg
)
{
console
.
log
(
msg
)
}
...
...
@@ -89,19 +98,21 @@ function Final_UpdateTable( action ) {
var
TimeRange
=
AjaxRecords
;
var
dataini
=
TheBuffer
[
0
]
.
toISOString
().
split
(
"T"
)[
0
]
var
datafin
=
TheBuffer
[
1
]
.
toISOString
().
split
(
"T"
)[
0
]
var
dataini
=
TheBuffer
[
0
]
;
var
datafin
=
TheBuffer
[
1
]
;
pr
(
"show me the pubs of the selected period"
)
console
.
log
(
TheBuffer
)
pr
(
"
\
tfrom ["
+
dataini
+
"] to ["
+
datafin
+
"]"
)
TimeRange
=
[]
for
(
var
i
in
AjaxRecords
)
{
if
(
AjaxRecords
[
i
].
date
>=
dataini
&&
AjaxRecords
[
i
].
date
<=
datafin
){
console
.
log
(
dataini
,
datafin
)
$
.
each
(
AjaxRecords
,
function
(
i
,
node
)
{
if
(
node
.
date
>=
dataini
&&
node
.
date
>=
dataini
)
{
// pr( AjaxRecords[i].date+" : "+AjaxRecords[i].id )
TimeRange
.
push
(
AjaxRecords
[
i
])
}
TimeRange
.
push
(
node
);
}
});
console
.
log
(
TimeRange
)
MyTable
=
$
(
'#my-ajax-table'
).
dynatable
({
dataset
:
{
...
...
@@ -292,16 +303,10 @@ function Main_test( Data , SearchFilter ) {
// console.log(Data[i]["date"]+" : originalRecords["+arr_id+"] <- "+orig_id+" | "+Data[i]["name"])
}
var
get_date
=
function
(
node
)
{
var
hyperdata
=
node
.
hyperdata
;
return
new
Date
(
Number
(
hyperdata
.
publication_year
),
Number
(
hyperdata
.
publication_month
)
-
1
,
Number
(
hyperdata
.
publication_day
)
);
};
var
t0
=
get_date
(
AjaxRecords
[
0
]);
var
t1
=
get_date
(
AjaxRecords
.
slice
(
-
1
)[
0
]);
var
t0
=
get_node_date
(
AjaxRecords
[
0
]);
var
t1
=
get_node_date
(
AjaxRecords
.
slice
(
-
1
)[
0
]);
oldest
=
t0
;
latest
=
t1
;
console
.
log
(
t0
,
t1
)
TheBuffer
=
[
t0
,
t1
];
...
...
@@ -310,15 +315,13 @@ function Main_test( Data , SearchFilter ) {
var
arrayd3
=
[]
$
.
each
(
Data
,
function
(
i
,
node
)
{
var
date
=
node
.
hyperdata
.
publication_date
;
if
(
justdates
[
date
]
!=
false
)
{
var
info
=
{};
info
.
date
=
date
;
info
.
dd
=
get_date
(
node
);
info
.
month
=
d3
.
time
.
month
(
info
.
dd
);
info
.
volume
=
justdates
[
date
];
arrayd3
.
push
(
info
);
justdates
[
date
]
=
false
;
if
(
node
.
date
)
{
arrayd3
.
push
({
date
:
get_node_date
(
node
),
dd
:
node
.
date
,
month
:
d3
.
time
.
month
(
node
.
date
),
volume
:
justdates
[
date
],
});
}
});
...
...
@@ -529,7 +532,7 @@ $("#corpusdisplayer").hide()
// FIRST portion of code to be EXECUTED:
// (3) Get records and hyperdata for paginator
$
.
ajax
({
url
:
'/api/nodes?type[]=DOCUMENT&parent_id='
+
corpus_id
,
url
:
'/api/nodes?type[]=DOCUMENT&pa
gination_limit=-1&pa
rent_id='
+
corpus_id
,
success
:
function
(
data
){
$
(
"#content_loader"
).
remove
();
$
.
each
(
data
.
records
,
function
(
i
,
record
){
...
...
@@ -538,6 +541,7 @@ $.ajax({
RecDict
[
orig_id
]
=
arr_id
;
record
.
title
=
record
.
name
;
record
.
name
=
'<a target="_blank" href="/projects/'
+
project_id
+
'/corpora/'
+
corpus_id
+
'/documents/'
+
record
.
id
+
'">'
+
record
.
name
+
'</a>'
;
record
.
date
=
get_node_date
(
record
);
record
.
del
=
false
;
});
for
(
var
i
in
data
.
records
)
{
...
...
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