From 63774cd1604c386291f1f0cb6520f1ee5ac96fc3 Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Tue, 26 Jul 2016 16:56:52 +0200 Subject: [PATCH] In moduleStats, if there is data which have small percentage, display it in an 'other' part + Added stacked chart for them (still draft) --- var/www/templates/Moduletrending.html | 120 +++++++++++++++--- .../trending_graphs/Moduletrending.html | 15 ++- 2 files changed, 110 insertions(+), 25 deletions(-) diff --git a/var/www/templates/Moduletrending.html b/var/www/templates/Moduletrending.html index ba36703f..ef8da227 100644 --- a/var/www/templates/Moduletrending.html +++ b/var/www/templates/Moduletrending.html @@ -18,6 +18,7 @@ + @@ -72,16 +73,41 @@ var chart_2_num_day = 15; $SCRIPT_ROOT = {{ request.script_root|tojson|safe }}; + +function labelFormatter(label, series) { + return "
" ++ label + "
" + Math.round(series.percent) + "%
"; +} + function plot_top_graph(module_name){ /**** Flot Pie Chart ****/ var options = { - series: { pie: { show: true } }, + series: { pie: { show: true, + radius: 3/5, + combine: { + color: '#999', + threshold: 0.05 + }, + label: { + show: true, + radius: 1, + formatter: labelFormatter, + background: { + opacity: 0.5, + color: '#000' + } + } + } + }, grid: { hoverable: true, clickable: true }, - legend: { show: false } + legend: { show: false }, + }; var moduleCharts = "size" == module_name ? "sizeCharts" : "moduleCharts"; + var tot_sum = 0; + var data_other = []; // Graph1 $.getJSON($SCRIPT_ROOT+"/_"+moduleCharts+"?moduleName="+module_name+"&num_day="+chart_1_num_day, function(data) { @@ -90,19 +116,23 @@ if (i==0 && data[0][0] == "passed_days"){ //If there is no data today, take it from the past if (data[0][1] > 0 && data[0][1] < 7){ $("#day-"+module_name).text(data[0][1] + " Day(s) ago "); - $("#panel-"+module_name).removeClass("panel-default") - $("#panel-"+module_name).addClass("panel-info") + $("#panel-"+module_name).removeClass("panel-green") + $("#panel-"+module_name).addClass("panel-yellow") } else if (data[0][1] > 6) { $("#day-"+module_name).text(data[0][1] + " Day(s) ago "); - $("#panel-"+module_name).removeClass("panel-default") - $("#panel-"+module_name).addClass("panel-warning") + $("#panel-"+module_name).removeClass("panel-green") + $("#panel-"+module_name).addClass("panel-red") } } else { temp_data_pie.push({label: data[i][0], data: data[i][1]}); + tot_sum += data[i][1] } } + for(i=0; i diff --git a/var/www/templates/trending_graphs/Moduletrending.html b/var/www/templates/trending_graphs/Moduletrending.html index 133fe137..5ef90a23 100644 --- a/var/www/templates/trending_graphs/Moduletrending.html +++ b/var/www/templates/trending_graphs/Moduletrending.html @@ -2,9 +2,10 @@
-
+
- Credential - Today most posted domain + Credential - most posted domain + Today
@@ -26,9 +27,10 @@
-
+
- Mail - Today most posted domain (max 1 per paste) + Mail - most posted domain (max 1 per paste) + Today
@@ -50,9 +52,10 @@
-
+
- Provider - Today average paste size + Provider - average paste size + Today