From e722a5c817fc84d4b1183833904639f8ac43b677 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 28 Nov 2013 15:03:29 +0100 Subject: [PATCH] // Dashgoals tooltip improved --- modules/dashgoals/views/js/dashgoals.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/dashgoals/views/js/dashgoals.js b/modules/dashgoals/views/js/dashgoals.js index a57e8bcb5..d01a2209b 100644 --- a/modules/dashgoals/views/js/dashgoals.js +++ b/modules/dashgoals/views/js/dashgoals.js @@ -1,7 +1,18 @@ function bar_chart_goals(widget_name, chart_details) { nv.addGraph(function() { - var chart = nv.models.multiBarChart().stacked(false).showControls(false); + var chart = nv.models.multiBarChart() + .stacked(false) + .showControls(false) + .tooltipContent(function(key, y, e, graph) { + var perf = parseInt(e) - 100; + if (perf > 0) + return '
' + key + '
+' + perf + '%
'; + else if (perf < 0) + return '
' + key + '
' + perf + '%
'; + else + return '
' + key + '
-
'; + }); chart.yAxis.tickFormat(d3.format('%'));