From 09fdaa3e39faf44e71f993a3c0848a1d58fa815e Mon Sep 17 00:00:00 2001 From: Mokaddem Date: Thu, 28 Jul 2016 12:06:54 +0200 Subject: [PATCH] Added tooltip for moduleStats bar chart --- var/www/static/js/moduleTrending.js | 25 +++++++++++++-- var/www/templates/Moduletrending.html | 1 - .../trending_graphs/Moduletrending.html | 32 ++++++++++++++----- 3 files changed, 46 insertions(+), 12 deletions(-) diff --git a/var/www/static/js/moduleTrending.js b/var/www/static/js/moduleTrending.js index 9d61f518..97b4af38 100644 --- a/var/www/static/js/moduleTrending.js +++ b/var/www/static/js/moduleTrending.js @@ -76,6 +76,21 @@ function plot_top_graph(module_name, init){ return; var clicked_label = item.series.label; update_bar_chart(moduleCharts, "#flot-bar-chart-"+module_name, clicked_label, item.series.color, chart_1_num_day, "%m/%d"); + + + $("#flot-bar-chart-"+module_name).bind("plothover", function (event, pos, item) { + if (item) { + var x = item.datapoint[0].toFixed(2); + var y = item.datapoint[1].toFixed(2); + var date = new Date(parseInt(x)); + date = date.getMonth()+'/'+date.getDate(); + + $("#tooltip_graph-"+module_name).html(item.series.label + " of " + date + " = " + y+"") + .css({padding: "2px", width: 'auto', 'background-color': 'white', 'border': "3px solid "+item.series.color}) + .fadeIn(200); + } else { + } + }); }); } }); @@ -100,8 +115,6 @@ function plot_top_graph(module_name, init){ noColumns: 0, position: "nw" }, - tooltip: true, - tooltipOpts: { content: "x: %x, y: %y" } }; if (involved_item == "Other"){ // If part 'Other' has been clicked @@ -142,6 +155,9 @@ function plot_top_graph(module_name, init){ tickSize: [1, 'day'], minTickSize: [1, "day"] }, + yaxis: { + transform: function (v) { return v < 1 ? v : Math.log(v); } + }, grid: { hoverable: true }, legend: { show: true, noColumns: 1, @@ -149,7 +165,10 @@ function plot_top_graph(module_name, init){ }, tooltip: true, tooltipOpts: { content: "x: %x, y: %y" } - }); + }) + + + }); } else { // Normal pie's part clicked diff --git a/var/www/templates/Moduletrending.html b/var/www/templates/Moduletrending.html index 20fba050..c7c2e88f 100644 --- a/var/www/templates/Moduletrending.html +++ b/var/www/templates/Moduletrending.html @@ -18,7 +18,6 @@ - diff --git a/var/www/templates/trending_graphs/Moduletrending.html b/var/www/templates/trending_graphs/Moduletrending.html index 9c970d66..ca5f2152 100644 --- a/var/www/templates/trending_graphs/Moduletrending.html +++ b/var/www/templates/trending_graphs/Moduletrending.html @@ -8,7 +8,10 @@ Today
-
+
+
+
+
Click on a part
@@ -33,7 +36,10 @@ Today
-
+
+
+
+
Click on a part
@@ -59,13 +65,23 @@
-

Average paste size by provider

-
-
Click on a part
+
+

Average paste size by provider

+
+
+
+
+
Click on a part
+
-

Number of paste by provider

-
-
Click on a part
+
+

Number of paste by provider

+
+
+
+
+
Click on a part
+