From 7e5ce0f17fd155ed7dcacaf249a6ac0aff4b836d Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Tue, 12 Jul 2016 11:47:51 +0200 Subject: [PATCH] Optimized create_plot and removed test commemts --- bin/WebStats.py | 9 ++++----- var/www/static/js/plot-graph.js | 8 ++++---- var/www/templates/Protocolstrending.html | 1 - var/www/templates/Trending.html | 3 +-- var/www/templates/Wordstrending.html | 1 - 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/bin/WebStats.py b/bin/WebStats.py index cac352af..71bbd944 100755 --- a/bin/WebStats.py +++ b/bin/WebStats.py @@ -133,19 +133,20 @@ if __name__ == '__main__': today = datetime.date.today() year = today.year month = today.month - print 'b1' + lib_words.create_curve_with_word_file(r_serv1, csv_path_proto, protocolsfile_path, year, month) - print 'b2' + lib_words.create_curve_with_word_file(r_serv1, csv_path_tld, tldsfile_path, year, month) - print 'b3' + lib_words.create_curve_with_list(r_serv2, csv_path_domain, to_plot, year, month) print 'end building' + publisher.debug("{} queue is empty, waiting".format(config_section)) print 'sleeping' time.sleep(5) @@ -161,5 +162,3 @@ if __name__ == '__main__': analyse(r_serv1, 'scheme') #Scheme analysis analyse(r_serv1, 'tld') #Tld analysis analyse_and_progression(r_serv2, 'domain') #Domain analysis - print "to_plot:" - print to_plot diff --git a/var/www/static/js/plot-graph.js b/var/www/static/js/plot-graph.js index 6daad3ba..f9a2ebf7 100644 --- a/var/www/static/js/plot-graph.js +++ b/var/www/static/js/plot-graph.js @@ -120,11 +120,11 @@ function Graph(id_pannel, path, header_size){ the_heading = headings[i]; //console.log('heading='+the_heading+' tab['+(today-1)+']['+(parseInt(i)+1)+']='+g.getValue(today-1, parseInt(i)+1)); sorted_list.push({dom: the_heading, val: this.graph.getValue(today-1, parseInt(i)+1), index: parseInt(i)}); - sorted_list.sort(function(a,b) { - return b.val - a.val; - }); - } + sorted_list.sort(function(a,b) { + return b.val - a.val; + }); + var display_list = sorted_list.slice(0, max_display); for( i=0; i5 - diff --git a/var/www/templates/Trending.html b/var/www/templates/Trending.html index dca69e51..113b1101 100644 --- a/var/www/templates/Trending.html +++ b/var/www/templates/Trending.html @@ -99,7 +99,6 @@ - @@ -139,7 +138,6 @@ - @@ -185,6 +183,7 @@ create_and_plot("TldsTrending", '../static//csv/tldstrendingdata.csv') }); + // Used when we modify the number of displayed curves function take_top(new_display){ current_displayed_graph.set_Visibility_andHide(new_display, default_display); default_display = new_display; diff --git a/var/www/templates/Wordstrending.html b/var/www/templates/Wordstrending.html index 22603b07..8980ead9 100644 --- a/var/www/templates/Wordstrending.html +++ b/var/www/templates/Wordstrending.html @@ -90,7 +90,6 @@ -