From df905ecf9705a67edbf7521bca0367c8c7825088 Mon Sep 17 00:00:00 2001
From: benakamoorthi <benaka.moorthi@gmail.com>
Date: Thu, 9 Aug 2012 13:05:46 +0000
Subject: [PATCH] Fixes #3295, make sure Piwik JQPlot class doesn't transform
 pie chart data twice.

git-svn-id: http://dev.piwik.org/svn/trunk@6705 59fd770c-687e-43c8-a1e3-f5a4ff64c105
---
 plugins/CoreHome/templates/jqplot.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/plugins/CoreHome/templates/jqplot.js b/plugins/CoreHome/templates/jqplot.js
index cd8116eea0..c2220c034d 100644
--- a/plugins/CoreHome/templates/jqplot.js
+++ b/plugins/CoreHome/templates/jqplot.js
@@ -390,8 +390,10 @@ JQPlot.prototype = {
 		};
 		
 		// pie charts have a different data format
-		for (var i = 0; i < this.data[0].length; i++) {
-			this.data[0][i] = [this.params.axes.xaxis.ticks[i], this.data[0][i]];
+		if (!(this.data[0][0] instanceof Array)) { // check if already in different format
+			for (var i = 0; i < this.data[0].length; i++) {
+				this.data[0][i] = [this.params.axes.xaxis.ticks[i], this.data[0][i]];
+			}
 		}
 	},
 	
@@ -1411,4 +1413,4 @@ RowEvolutionSeriesToggle.prototype.beforeReplot = function() {
 	$.jqplot.preInitHooks.push($.jqplot.PieLegend.init);
 	$.jqplot.postDrawHooks.push($.jqplot.PieLegend.postDraw);
 	
-})(jQuery);
\ No newline at end of file
+})(jQuery);
-- 
GitLab