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
18fb1332
Commit
18fb1332
authored
Nov 29, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable-201511-advancedcharts' into unstable
parents
8630ddaa
951381a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
74 additions
and
14 deletions
+74
-14
api2.py
gargantext_web/api2.py
+2
-2
gargantext.angular.js
static/js/gargantext.angular.js
+56
-4
chart.html
templates/chart.html
+16
-8
No files found.
gargantext_web/api2.py
View file @
18fb1332
...
@@ -86,6 +86,7 @@ class NodeNgramsQueries(APIView):
...
@@ -86,6 +86,7 @@ class NodeNgramsQueries(APIView):
'contains'
:
lambda
field
,
value
:
(
field
.
contains
(
value
)),
'contains'
:
lambda
field
,
value
:
(
field
.
contains
(
value
)),
'doesnotcontain'
:
lambda
field
,
value
:
(
not_
(
field
.
contains
(
value
))),
'doesnotcontain'
:
lambda
field
,
value
:
(
not_
(
field
.
contains
(
value
))),
'startswith'
:
lambda
field
,
value
:
(
field
.
startswith
(
value
)),
'startswith'
:
lambda
field
,
value
:
(
field
.
startswith
(
value
)),
'endswith'
:
lambda
field
,
value
:
(
field
.
endswith
(
value
)),
}
}
_converters
=
{
_converters
=
{
...
@@ -93,7 +94,7 @@ class NodeNgramsQueries(APIView):
...
@@ -93,7 +94,7 @@ class NodeNgramsQueries(APIView):
'int'
:
int
,
'int'
:
int
,
'datetime'
:
lambda
x
:
x
+
'2000-01-01 00:00:00Z'
[
len
(
x
):],
'datetime'
:
lambda
x
:
x
+
'2000-01-01 00:00:00Z'
[
len
(
x
):],
'text'
:
str
,
'text'
:
str
,
'str'
:
str
,
'str
ing
'
:
str
,
}
}
...
@@ -219,7 +220,6 @@ class NodeNgramsQueries(APIView):
...
@@ -219,7 +220,6 @@ class NodeNgramsQueries(APIView):
.
filter
(
NH
.
hyperdata_id
==
hyperdata_id
)
.
filter
(
NH
.
hyperdata_id
==
hyperdata_id
)
.
filter
(
operator
(
NH_column
,
value
))
.
filter
(
operator
(
NH_column
,
value
))
)
)
# build result: prepare data
# build result: prepare data
date_value_list
=
query_result
.
all
()
date_value_list
=
query_result
.
all
()
if
date_value_list
:
if
date_value_list
:
...
...
static/js/gargantext.angular.js
View file @
18fb1332
...
@@ -242,18 +242,46 @@ gargantext.controller('DatasetController', function($scope, $http) {
...
@@ -242,18 +242,46 @@ gargantext.controller('DatasetController', function($scope, $http) {
$
.
each
(
$scope
.
corpora
,
function
(
c
,
corpus
){
$
.
each
(
$scope
.
corpora
,
function
(
c
,
corpus
){
corpus
.
is_selected
=
false
;
corpus
.
is_selected
=
false
;
});
});
$scope
.
updateDataset
();
$scope
.
_updateHyperdataList
(
function
()
{
$scope
.
updateDataset
();
});
};
};
$scope
.
corporaSelectAll
=
function
()
{
$scope
.
corporaSelectAll
=
function
()
{
$
.
each
(
$scope
.
corpora
,
function
(
c
,
corpus
){
$
.
each
(
$scope
.
corpora
,
function
(
c
,
corpus
){
corpus
.
is_selected
=
true
;
corpus
.
is_selected
=
true
;
});
});
$scope
.
updateDataset
();
$scope
.
_updateHyperdataList
(
function
()
{
$scope
.
updateDataset
();
});
};
};
// filters:
meta
data, according to the considered corpora
// filters:
hyper
data, according to the considered corpora
$scope
.
hyperdataList
=
[];
$scope
.
hyperdataList
=
[];
$scope
.
updateHyperdataTimer
=
null
;
$scope
.
setHyperdataList
=
function
(
hyperdataList
)
{
// add an empty item for each value
$
.
each
(
hyperdataList
,
function
(
h
,
hyperdata
)
{
if
(
hyperdata
.
values
)
{
hyperdata
.
values
.
unshift
(
undefined
);
}
});
// do not keep the ones we are not interested into
var
rejectedHyperdata
=
[
'doi'
,
'volume'
,
'page'
];
$scope
.
hyperdataList
=
[];
$
.
each
(
hyperdataList
,
function
(
h
,
hyperdata
)
{
if
(
rejectedHyperdata
.
indexOf
(
hyperdata
.
key
)
==
-
1
)
{
hyperdata
.
name
=
hyperdata
.
key
.
split
(
'_'
)[
0
];
$scope
.
hyperdataList
.
push
(
hyperdata
);
}
});
}
$scope
.
updateHyperdataList
=
function
()
{
$scope
.
updateHyperdataList
=
function
()
{
if
(
$scope
.
updateHyperdataTimer
)
{
clearTimeout
(
$scope
.
updateHyperdataTimer
);
}
$scope
.
updateHyperdataTimer
=
setTimeout
(
$scope
.
_updateHyperdataList
,
500
);
};
$scope
.
_updateHyperdataList
=
function
(
callback
)
{
var
corpus_id_list
=
getSelectedCorporaIdList
();
var
corpus_id_list
=
getSelectedCorporaIdList
();
if
(
corpus_id_list
&&
corpus_id_list
.
length
)
{
if
(
corpus_id_list
&&
corpus_id_list
.
length
)
{
var
url
=
'/api/hyperdata?corpus_id='
;
var
url
=
'/api/hyperdata?corpus_id='
;
...
@@ -261,7 +289,10 @@ gargantext.controller('DatasetController', function($scope, $http) {
...
@@ -261,7 +289,10 @@ gargantext.controller('DatasetController', function($scope, $http) {
$scope
.
is_loading
=
true
;
$scope
.
is_loading
=
true
;
$http
.
get
(
url
,
{
cache
:
true
}).
success
(
function
(
response
){
$http
.
get
(
url
,
{
cache
:
true
}).
success
(
function
(
response
){
$scope
.
is_loading
=
false
;
$scope
.
is_loading
=
false
;
$scope
.
hyperdataList
=
response
.
data
;
$scope
.
setHyperdataList
(
response
.
data
);
if
(
callback
)
{
callback
();
}
});
});
}
else
{
}
else
{
$scope
.
hyperdataList
=
[];
$scope
.
hyperdataList
=
[];
...
@@ -269,7 +300,14 @@ gargantext.controller('DatasetController', function($scope, $http) {
...
@@ -269,7 +300,14 @@ gargantext.controller('DatasetController', function($scope, $http) {
};
};
// update the dataset, according to the various filters applied to it
// update the dataset, according to the various filters applied to it
$scope
.
updateDatasetTimer
=
null
;
$scope
.
updateDataset
=
function
()
{
$scope
.
updateDataset
=
function
()
{
if
(
$scope
.
updateDatasetTimer
)
{
clearTimeout
(
$scope
.
updateDatasetTimer
);
}
$scope
.
updateDatasetTimer
=
setTimeout
(
$scope
.
_updateDataset
,
500
);
};
$scope
.
_updateDataset
=
function
()
{
// parameters
// parameters
var
parameters
=
{
var
parameters
=
{
'x'
:
{
'x'
:
{
...
@@ -296,6 +334,20 @@ gargantext.controller('DatasetController', function($scope, $http) {
...
@@ -296,6 +334,20 @@ gargantext.controller('DatasetController', function($scope, $http) {
})
})
console
.
log
(
$scope
.
query_y
.
ngrams
);
console
.
log
(
$scope
.
query_y
.
ngrams
);
}
}
// filter: hyperdata
parameters
.
filter
.
hyperdata
=
[];
$
.
each
(
$scope
.
hyperdataList
,
function
(
h
,
hyperdata
)
{
if
((
hyperdata
.
values
||
hyperdata
.
operator
)
&&
hyperdata
.
value
)
{
if
(
hyperdata
.
values
)
{
hyperdata
.
operator
=
'='
;
}
parameters
.
filter
.
hyperdata
.
push
({
'key'
:
hyperdata
.
key
,
'operator'
:
hyperdata
.
operator
,
'value'
:
hyperdata
.
value
});
}
});
// retrieve data
// retrieve data
var
url
=
'/api2/nodes/'
+
$scope
.
project_id
+
'/histories'
;
var
url
=
'/api2/nodes/'
+
$scope
.
project_id
+
'/histories'
;
$scope
.
is_loading
=
true
;
$scope
.
is_loading
=
true
;
...
...
templates/chart.html
View file @
18fb1332
...
@@ -53,8 +53,9 @@
...
@@ -53,8 +53,9 @@
li
.dataset
select
{
cursor
:
pointer
;
border
:
0
;
padding
:
0
;
}
li
.dataset
select
{
cursor
:
pointer
;
border
:
0
;
padding
:
0
;
}
ul
.filters
{
list-style
:
none
;
margin
:
0
;
padding
:
0
;
margin-top
:
.25em
;}
ul
.filters
{
list-style
:
none
;
margin
:
0
;
padding
:
0
;
margin-top
:
.25em
;}
ul
.filters
>
li
{
padding-top
:
.5em
;
margin-top
:
.5em
;
border-top
:
solid
1px
rgba
(
0
,
0
,
0
,
.125
);}
ul
.filters
>
li
{
padding-top
:
.5em
;
margin-top
:
.5em
;
border-top
:
solid
1px
rgba
(
0
,
0
,
0
,
.125
);}
ul
.filters
>
li
>
ul
{
list-style
:
none
;
padding-left
:
0
;
}
ul
.filters
>
li
>
ul
{
list-style
:
none
;
padding-left
:
0
;
margin-top
:
.5em
;
}
ul
.filters
>
li
>
ul
label
{
font-weight
:
normal
;
cursor
:
pointer
;
}
ul
.filters
>
li
>
ul
>
li
.inline
{
width
:
30%
;
display
:
inline-block
;
}
ul
.filters
>
li
>
ul
>
li
>
label
{
font-weight
:
normal
;
cursor
:
pointer
;
}
ul
.filters
>
li
input
[
type
=
checkbox
]
{
opacity
:
.8
;}
ul
.filters
>
li
input
[
type
=
checkbox
]
{
opacity
:
.8
;}
</style>
</style>
...
@@ -85,7 +86,7 @@
...
@@ -85,7 +86,7 @@
<button
ng-click=
"corporaSelectNone()"
>
select none
</button>
<button
ng-click=
"corporaSelectNone()"
>
select none
</button>
...restrict to the following corpora:
...restrict to the following corpora:
<ul>
<ul>
<li
ng-repeat=
"corpus in corpora"
>
<li
ng-repeat=
"corpus in corpora"
class=
"inline"
>
<label>
<label>
<input
type=
"checkbox"
ng-model=
"corpus.is_selected"
ng-change=
"updateHyperdataList();updateDataset()"
/>
<input
type=
"checkbox"
ng-model=
"corpus.is_selected"
ng-change=
"updateHyperdataList();updateDataset()"
/>
<span
style=
"font-weight: {{ corpus.is_selected ? 'bold' : 'normal' }}"
>
{{ corpus.name }}
</span>
<span
style=
"font-weight: {{ corpus.is_selected ? 'bold' : 'normal' }}"
>
{{ corpus.name }}
</span>
...
@@ -104,12 +105,19 @@
...
@@ -104,12 +105,19 @@
<li>
<li>
<ul>
<ul>
<li
ng-repeat=
"hyperdata in hyperdataList"
>
<li
ng-repeat=
"hyperdata in hyperdataList"
>
...where the value of
...where
<span
ng-if=
"!hyperdata.operator"
>
"{{ hyperdata.key }}"
</span>
<span
ng-if=
"!hyperdata.operator && (!hyperdata.values || !hyperdata.value)"
>
"{{ hyperdata.name }}"
</span>
<strong
ng-if=
"hyperdata.operator"
>
{{ hyperdata.key }}
</strong>
<strong
ng-if=
"hyperdata.operator || (hyperdata.values && hyperdata.value)"
>
{{ hyperdata.name }}
</strong>
<span
ng-if=
"hyperdata.values"
>
is
<select
ng-model=
"hyperdata.value"
ng-options=
"value for value in hyperdata.values"
ng-change=
"updateDataset()"
></select>
</span>
<span
ng-if=
"!hyperdata.values"
>
<select
ng-model=
"hyperdata.operator"
ng-options=
"operator.key as operator.label for operator in operators[hyperdata.type]"
></select>
<input
type=
"text"
ng-if=
"hyperdata.operator"
ng-model=
"hyperdata.value"
ng-change=
"updateDataset()"
placeholder=
"type a value here..."
/>
</span>
<select
ng-model=
"hyperdata.operator"
ng-options=
"operator.key as operator.label for operator in operators[hyperdata.type]"
></select>
<input
type=
"text"
ng-if=
"hyperdata.operator"
ng-model=
"hyperdata.value"
ng-change=
"updateDataset()"
placeholder=
"type a value here..."
/>
</li>
</li>
</ul>
</ul>
</li>
</li>
...
...
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