From e3ec12b41917512377930fe4bca91cf4903fccdc Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Mon, 21 Mar 2016 21:26:12 -0700
Subject: [PATCH] Fix incorrect pie chart detail

---
 frontend/src/visualizations/PieChart.jsx | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/frontend/src/visualizations/PieChart.jsx b/frontend/src/visualizations/PieChart.jsx
index 2fd3e8dcc70..606b957c52d 100644
--- a/frontend/src/visualizations/PieChart.jsx
+++ b/frontend/src/visualizations/PieChart.jsx
@@ -57,16 +57,6 @@ export default class PieChart extends Component {
 
         let total = data.rows.reduce((sum, row) => sum + row[1], 0);
 
-        let value, title;
-        if (hovered && hovered.index != null) {
-            const row = series[0].data.rows[hovered.index];
-            title = formatDimension(row[0]);
-            value = formatMetric(row[1]);
-        } else {
-            title = "Total";
-            value = formatMetric(total);
-        }
-
         let sliceColors = Object.values(colors.normal);
 
         let [slices, others] = _.chain(data.rows)
@@ -125,6 +115,15 @@ export default class PieChart extends Component {
             ]
         });
 
+        let value, title;
+        if (hovered && hovered.index != null && slices[hovered.index] !== otherSlice) {
+            title = slices[hovered.index].key;
+            value = slices[hovered.index].value;
+        } else {
+            title = "Total";
+            value = formatMetric(total);
+        }
+
         return (
             <ChartWithLegend
                 className={className}
-- 
GitLab