From 60bffb44f501bcb054faa87d633145aa5c673f04 Mon Sep 17 00:00:00 2001
From: Thomas Steur <thomas.steur@googlemail.com>
Date: Thu, 21 Aug 2014 09:06:10 +0200
Subject: [PATCH] refs #5970 make sure to reload the same page if user clicks
 on a date in the evolution chart, even if the metric was changed

---
 .../javascripts/jqplotEvolutionGraph.js       | 25 +++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js b/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
index a422dd79e2..a776ee7df5 100644
--- a/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
+++ b/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
@@ -89,6 +89,31 @@
                     if (lastTick !== false && typeof self.jqplotParams.axes.xaxis.onclick != 'undefined'
                         && typeof self.jqplotParams.axes.xaxis.onclick[lastTick] == 'string') {
                         var url = self.jqplotParams.axes.xaxis.onclick[lastTick];
+
+                        if (url && -1 === url.indexOf('#')) {
+                            var module = broadcast.getValueFromHash('module');
+                            var action = broadcast.getValueFromHash('action');
+                            var idSite = broadcast.getValueFromUrl('idSite', url);
+                            var period = broadcast.getValueFromUrl('period', url);
+                            var date   = broadcast.getValueFromUrl('date', url);
+
+                            if (module && action) {
+                                url += '#module=' + module + '&action=' + action;
+
+                                if (idSite) {
+                                    url += '&idSite=' + idSite;
+                                }
+
+                                if (period) {
+                                    url += '&period=' + period;
+                                }
+
+                                if (period) {
+                                    url += '&date=' + date;
+                                }
+                            }
+                        }
+
                         piwikHelper.redirectToUrl(url);
                     }
                 })
-- 
GitLab