From 524babbdee87e7c5ca23ccc23a6ebe1394769471 Mon Sep 17 00:00:00 2001
From: Tom Robinson <tlrobinson@gmail.com>
Date: Wed, 8 Jul 2015 03:29:16 -0700
Subject: [PATCH] Handle nulls in pie, line, and bar charts

---
 resources/frontend_client/app/card/card.charting.js | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/resources/frontend_client/app/card/card.charting.js b/resources/frontend_client/app/card/card.charting.js
index ced94fb7791..6fc186b4ba3 100644
--- a/resources/frontend_client/app/card/card.charting.js
+++ b/resources/frontend_client/app/card/card.charting.js
@@ -311,9 +311,10 @@ function applyChartOrdinalXAxis(chart, card, coldefs, data, minPixelsPerTick) {
 
             xAxis.tickValues(visibleKeys);
         }
+        xAxis.tickFormat((d) => d == null ? '[unset]' : d);
     } else {
         xAxis.ticks(0);
-        xAxis.tickFormat(function(d) { return ""; });
+        xAxis.tickFormat('');
     }
 
     chart.x(d3.scale.ordinal().domain(keys))
@@ -799,6 +800,9 @@ export var CardRenderer = {
                             var index = _.indexOf(keys, d.key);
                             return settings.pie.colors[index % settings.pie.colors.length];
                         })
+                        .label(function(row) {
+                            return row.key == null ? '[unset]' : row.key;
+                        })
                         .title(function(d) {
                             // ghetto rounding to 1 decimal digit since Math.round() doesn't let
                             // you specify a precision and always rounds to int
@@ -806,6 +810,8 @@ export var CardRenderer = {
                             return d.key + ': ' + d.value + ' (' + percent + '%)';
                         });
 
+            // disables ability to select slices
+            chart.filter = function() {};
 
         applyChartTooltips(chart, card, result.cols);
 
-- 
GitLab