This is an automated email from the ASF dual-hosted git repository.

villebro pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 7ac1a29  Fixed Histogram visualization bug.  (#8077)
7ac1a29 is described below

commit 7ac1a290eb013418091a58e92958971348f290e3
Author: kuckjwi <[email protected]>
AuthorDate: Sun Aug 25 02:52:38 2019 +0900

    Fixed Histogram visualization bug.  (#8077)
    
    * Fix HistogramViz bug.
    
    * Fix ci black error.
---
 superset/viz.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/superset/viz.py b/superset/viz.py
index 68d343e..192c8fb 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -1475,18 +1475,22 @@ class HistogramViz(BaseViz):
         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):
+        if isinstance(keys, str) or isinstance(keys, int):
             keys = (keys,)
+
         # removing undesirable characters
-        labels = [re.sub(r"\W+", r"_", k) for k in keys]
-        if len(self.columns) > 1 or not self.groupby:
+        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:
             # Only show numeric column in label if there are many
             labels = [column] + labels
         return "__".join(labels)

Reply via email to