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
e1b6143a
Commit
e1b6143a
authored
Oct 12, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
histogram: simpler div management and background hiding
parent
68d77288
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
10 deletions
+16
-10
histogram.css
histogramModule/histogram.css
+4
-1
wosHistogram.js
histogramModule/wosHistogram.js
+12
-9
No files found.
histogramModule/histogram.css
View file @
e1b6143a
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
#search_histogram_wrapper
{
#search_histogram_wrapper
{
margin
:
0
;
margin
:
0
;
/* overwrite bootstrap's
/* overwrite bootstrap's
* grid element padding*/
* grid element padding*/
padding-right
:
2em
;
padding-right
:
2em
;
margin-left
:
-.5em
;
margin-left
:
-.5em
;
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#search_histogram
{
#search_histogram
{
min-height
:
15em
;
min-height
:
15em
;
font-size
:
85%
;
font-size
:
85%
;
background-color
:
#F9F9F9
;
display
:
none
;
}
}
/* dygraph internal canvas */
/* dygraph internal canvas */
#search_histogram
canvas
{
#search_histogram
canvas
{
...
...
histogramModule/wosHistogram.js
View file @
e1b6143a
...
@@ -33,6 +33,8 @@ var wosYearTotals = {
...
@@ -33,6 +33,8 @@ var wosYearTotals = {
"2015"
:
1772592
"2015"
:
1772592
}
}
var
$search_histogram
=
$
(
"#search_histogram"
)
//method for calling the ISC-API and get pubs-distribution of the suggested term
//method for calling the ISC-API and get pubs-distribution of the suggested term
function
search_proposed_terms_and_draw
(
the_queries
)
{
function
search_proposed_terms_and_draw
(
the_queries
)
{
...
@@ -40,7 +42,7 @@ function search_proposed_terms_and_draw( the_queries ) {
...
@@ -40,7 +42,7 @@ function search_proposed_terms_and_draw( the_queries ) {
// +"i'm searching:\n"
// +"i'm searching:\n"
// +JSON.stringify(the_queries)) ;
// +JSON.stringify(the_queries)) ;
$
(
"#search_histogram"
)
.
html
(
"Searching for matching WOS data..."
)
$
search_histogram
.
html
(
"Searching for matching WOS data..."
)
var
args
=
{
var
args
=
{
// the_queries is an array of str
// the_queries is an array of str
...
@@ -50,7 +52,7 @@ function search_proposed_terms_and_draw( the_queries ) {
...
@@ -50,7 +52,7 @@ function search_proposed_terms_and_draw( the_queries ) {
}
}
var
docs_years
=
[]
;
var
docs_years
=
[]
;
$
(
"#search_histogram"
)
$
search_histogram
.
html
(
'<p class="micromessage">Waiting for histogram data</p>'
)
.
html
(
'<p class="micromessage">Waiting for histogram data</p>'
)
$
.
ajax
({
$
.
ajax
({
...
@@ -80,10 +82,10 @@ function search_proposed_terms_and_draw( the_queries ) {
...
@@ -80,10 +82,10 @@ function search_proposed_terms_and_draw( the_queries ) {
}
}
// docs_years is now an array of couples [[1989,42],[1990,100],...]
// docs_years is now an array of couples [[1989,42],[1990,100],...]
console
.
log
(
"docs_years"
,
docs_years
)
//
console.log("docs_years",docs_years)
// counts_by_year_array
// counts_by_year_array
draw_histogram
(
docs_years
,
"search_histogram"
)
;
draw_histogram
(
docs_years
)
;
return
true
;
return
true
;
}
}
},
},
...
@@ -91,7 +93,7 @@ function search_proposed_terms_and_draw( the_queries ) {
...
@@ -91,7 +93,7 @@ function search_proposed_terms_and_draw( the_queries ) {
error
:
function
(
exception
)
{
error
:
function
(
exception
)
{
console
.
log
(
"search_proposed_terms_and_draw:exception"
console
.
log
(
"search_proposed_terms_and_draw:exception"
+
JSON
.
stringify
(
exception
))
+
JSON
.
stringify
(
exception
))
$
(
"#search_histogram"
)
$
search_histogram
.
html
(
'<p class="micromessage">'
.
html
(
'<p class="micromessage">'
+
'<b>No histogram</b>: too many nodes selected</b>'
+
'<b>No histogram</b>: too many nodes selected</b>'
+
'</p>'
)
+
'</p>'
)
...
@@ -113,11 +115,13 @@ $("#searchinput").on("tw:gotNodeSet", function(e) {
...
@@ -113,11 +115,13 @@ $("#searchinput").on("tw:gotNodeSet", function(e) {
$
(
"#searchinput"
).
on
(
"tw:eraseNodeSet"
,
function
(
e
)
{
$
(
"#searchinput"
).
on
(
"tw:eraseNodeSet"
,
function
(
e
)
{
// console.log("event 'erase'") ;
// console.log("event 'erase'") ;
clean_histogram
()
;
clean_histogram
()
;
$search_histogram
.
hide
()
;
});
});
// emptyNodeSet event when Tinaweb search found nothing
// emptyNodeSet event when Tinaweb search found nothing
$
(
"#searchinput"
).
on
(
"tw:emptyNodeSet"
,
function
(
e
)
{
$
(
"#searchinput"
).
on
(
"tw:emptyNodeSet"
,
function
(
e
)
{
clean_histogram
()
;
clean_histogram
()
;
$search_histogram
.
hide
()
;
});
});
...
@@ -146,12 +150,11 @@ function newnodesHistogramBehavior(selectedNodeIds, unusedQuery) {
...
@@ -146,12 +150,11 @@ function newnodesHistogramBehavior(selectedNodeIds, unusedQuery) {
// use dygraph lib to draw below the crowdsourcing div
// use dygraph lib to draw below the crowdsourcing div
function
draw_histogram
(
counts_by_year_array
,
div_id
)
{
function
draw_histogram
(
counts_by_year_array
)
{
// 1) layout for the div#search_histogram
// 1) layout for the div#search_histogram
// /!\ this div *needs* padding:0 /!\;
// /!\ this div *needs* padding:0 /!\;
$
(
"#"
+
div_id
).
height
(
"15em"
)
$search_histogram
.
height
(
"15em"
).
show
()
.
css
(
"background-color"
,
"#F9F9F9"
)
// 2) data preparation
// 2) data preparation
//~ var years = [] ;
//~ var years = [] ;
...
@@ -164,7 +167,7 @@ function draw_histogram(counts_by_year_array, div_id) {
...
@@ -164,7 +167,7 @@ function draw_histogram(counts_by_year_array, div_id) {
// console.log('=== GRAPH PREPARATION ===') ;
// console.log('=== GRAPH PREPARATION ===') ;
// 3) call histogram lib
// 3) call histogram lib
new
Dygraph
(
document
.
getElementById
(
div_id
)
,
new
Dygraph
(
$search_histogram
[
0
]
,
counts_by_year_array
,
counts_by_year_array
,
{
{
labels
:
[
'year'
,
'n'
],
labels
:
[
'year'
,
'n'
],
...
...
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