mirror of https://github.com/apache/superset.git
This reverts commit 7ac1a290eb
.
This commit is contained in:
parent
7f17ba7ee2
commit
1b031fc7d7
|
@ -1475,22 +1475,18 @@ class HistogramViz(BaseViz):
|
||||||
numeric_columns = self.form_data.get("all_columns_x")
|
numeric_columns = self.form_data.get("all_columns_x")
|
||||||
if numeric_columns is None:
|
if numeric_columns is None:
|
||||||
raise Exception(_("Must have at least one numeric column specified"))
|
raise Exception(_("Must have at least one numeric column specified"))
|
||||||
self.columns = [numeric_columns]
|
self.columns = numeric_columns
|
||||||
d["columns"] = [numeric_columns] + self.groupby
|
d["columns"] = numeric_columns + self.groupby
|
||||||
# override groupby entry to avoid aggregation
|
# override groupby entry to avoid aggregation
|
||||||
d["groupby"] = []
|
d["groupby"] = []
|
||||||
return d
|
return d
|
||||||
|
|
||||||
def labelify(self, keys, column):
|
def labelify(self, keys, column):
|
||||||
if isinstance(keys, str) or isinstance(keys, int):
|
if isinstance(keys, str):
|
||||||
keys = (keys,)
|
keys = (keys,)
|
||||||
|
|
||||||
# removing undesirable characters
|
# removing undesirable characters
|
||||||
labels = [
|
labels = [re.sub(r"\W+", r"_", k) for k in keys]
|
||||||
re.sub(r"\W+", r"_", k) if isinstance(k, str) else str(k) for k in keys
|
if len(self.columns) > 1 or not self.groupby:
|
||||||
]
|
|
||||||
|
|
||||||
if len(self.columns) > 0 or not self.groupby:
|
|
||||||
# Only show numeric column in label if there are many
|
# Only show numeric column in label if there are many
|
||||||
labels = [column] + labels
|
labels = [column] + labels
|
||||||
return "__".join(labels)
|
return "__".join(labels)
|
||||||
|
|
Loading…
Reference in New Issue