From acec508f53196ab26d1db087827de2ddeb26f36a Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Thu, 28 Jul 2016 09:52:07 +0200 Subject: [PATCH] fixed multiple binding bug in moduleStats + Added multiple bar display for 'other pie part' + Added ModuleStats tab in all other pages --- var/www/Flask_server.py | 2 + var/www/static/js/moduleTrending.js | 63 +++++++++---------- var/www/templates/Moduletrending.html | 16 ++--- var/www/templates/Trending.html | 2 +- var/www/templates/index.html | 1 + .../trending_graphs/Moduletrending.html | 16 ++--- 6 files changed, 51 insertions(+), 49 deletions(-) diff --git a/var/www/Flask_server.py b/var/www/Flask_server.py index 30fdb4e2..baae91cf 100755 --- a/var/www/Flask_server.py +++ b/var/www/Flask_server.py @@ -196,6 +196,7 @@ def modulesCharts(): for date in date_range: curr_value = r_serv_charts.hget(date, module_name+'-'+keyword_name) bar_values.append([date[0:4]+'/'+date[4:6]+'/'+date[6:8], int(curr_value if curr_value is not None else 0)]) + bar_values.insert(0, keyword_name) return jsonify(bar_values) else: @@ -220,6 +221,7 @@ def providersChart(): for date in date_range: curr_value = r_serv_charts.hget(keyword_name+'_'+module_name, date) bar_values.append([date[0:4]+'/'+date[4:6]+'/'+date[6:8], float(curr_value if curr_value is not None else 0.0)]) + bar_values.insert(0, keyword_name) return jsonify(bar_values) else: diff --git a/var/www/static/js/moduleTrending.js b/var/www/static/js/moduleTrending.js index e43887ec..9d61f518 100644 --- a/var/www/static/js/moduleTrending.js +++ b/var/www/static/js/moduleTrending.js @@ -34,17 +34,17 @@ function labelFormatter(label, series) { } -function plot_top_graph(module_name){ +function plot_top_graph(module_name, init){ /**** Pie Chart ****/ // moduleCharts is used the decide the url to request data var moduleCharts = "size" == module_name ? "providersChart" : ("num" == module_name ? "providersChart" : "moduleCharts"); - var tot_sum = 0; // used to detect elements putted in 'Other' pie's part - var data_other = []; // used to detect elements putted in 'Other' pie's part + var tot_sum = 0; // used to detect elements placed in 'Other' pie's part + var data_other = []; // used to detect elements placed in 'Other' pie's part - $.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day, + var createPie = $.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day, function(data) { var temp_data_pie = []; for(i=0; i @@ -62,18 +62,18 @@