Commit 6dbfd612 authored by Romain Loth's avatar Romain Loth

histogram also gets a threshold in harmony with gexf 'age' from last commit

parent b5681d9a
...@@ -7,7 +7,6 @@ var hg ...@@ -7,7 +7,6 @@ var hg
var $search_histogram = $("#search_histogram2") var $search_histogram = $("#search_histogram2")
//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 ) {
...@@ -44,19 +43,27 @@ function search_proposed_terms_and_draw( the_queries ) { ...@@ -44,19 +43,27 @@ function search_proposed_terms_and_draw( the_queries ) {
// ES aggs response, for example // ES aggs response, for example
// data = {"took":91,"total":121673,"aggs":{"publicationCount":{"buckets":[{"key":1989,"doc_count":880},{"key":1990,"doc_count":1088},...,{"key":2012,"doc_count":9543},{"key":2013,"doc_count":8832}]}},"hits":{"total":121673,"max_score":0,"hits":[]}} // data = {"took":91,"total":121673,"aggs":{"publicationCount":{"buckets":[{"key":1989,"doc_count":880},{"key":1990,"doc_count":1088},...,{"key":2012,"doc_count":9543},{"key":2013,"doc_count":8832}]}},"hits":{"total":121673,"max_score":0,"hits":[]}}
console.log(">> incoming api data <<") // console.log(">> incoming api data <<")
console.log(data) // console.log(data)
if(data.results.total==0) { if(data.results.total==0) {
return false; return false;
} }
else { else {
var startRecordingFlag = false
for(var i in data.results.hits) { for(var i in data.results.hits) {
var elem = data.results.hits[i] var elem = data.results.hits[i]
var day = elem.key_as_string+"" var day = elem.key_as_string+""
var ndocs = elem.doc_count var ndocs = elem.doc_count
docs_days.push( [ day , ndocs] ) if (! startRecordingFlag
&& ndocs > TW.histogramStartThreshold) {
startRecordingFlag = true
}
if (startRecordingFlag) {
docs_days.push( [ day , ndocs] )
}
} }
// docs_days is now an array of couples [["2016-01-04T00:00:00.000Z",25],["2016-01-05T00:00:00.000Z",28],...] // docs_days is now an array of couples [["2016-01-04T00:00:00.000Z",25],["2016-01-05T00:00:00.000Z",28],...]
......
...@@ -105,6 +105,8 @@ TW.nodeClusAtt = "modularity_class" ...@@ -105,6 +105,8 @@ TW.nodeClusAtt = "modularity_class"
TW.filterSliders = false TW.filterSliders = false
TW.histogramStartThreshold = 10 ;
TW.edgeDefaultOpacity = 0.5 // opacity when true_color TW.edgeDefaultOpacity = 0.5 // opacity when true_color
TW.edgeGreyColor = "rgba(150, 150, 150, 0.2)"; TW.edgeGreyColor = "rgba(150, 150, 150, 0.2)";
TW.nodesGreyBorderColor = "rgba(100, 100, 100, 0.5)"; TW.nodesGreyBorderColor = "rgba(100, 100, 100, 0.5)";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment