From f9c8c500c5c893fda31a2d8153464fde42e4dad5 Mon Sep 17 00:00:00 2001 From: Erik Ritter Date: Fri, 30 Aug 2019 11:43:16 -0700 Subject: [PATCH] Revert "Fixed Histogram visualization bug. (#8077)" This reverts commit 7ac1a290eb013418091a58e92958971348f290e3. --- superset/viz.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/superset/viz.py b/superset/viz.py index 192c8fb5de02c..68d343ee8ca0e 100644 --- a/superset/viz.py +++ b/superset/viz.py @@ -1475,22 +1475,18 @@ def query_obj(self): numeric_columns = self.form_data.get("all_columns_x") if numeric_columns is None: raise Exception(_("Must have at least one numeric column specified")) - self.columns = [numeric_columns] - d["columns"] = [numeric_columns] + self.groupby + self.columns = numeric_columns + d["columns"] = numeric_columns + self.groupby # override groupby entry to avoid aggregation d["groupby"] = [] return d def labelify(self, keys, column): - if isinstance(keys, str) or isinstance(keys, int): + if isinstance(keys, str): keys = (keys,) - # removing undesirable characters - labels = [ - re.sub(r"\W+", r"_", k) if isinstance(k, str) else str(k) for k in keys - ] - - if len(self.columns) > 0 or not self.groupby: + labels = [re.sub(r"\W+", r"_", k) for k in keys] + if len(self.columns) > 1 or not self.groupby: # Only show numeric column in label if there are many labels = [column] + labels return "__".join(labels)