Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove unnecessary shims from viz.py #9765

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion superset-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"@superset-ui/legacy-plugin-chart-world-map": "^0.13.6",
"@superset-ui/legacy-preset-chart-big-number": "^0.13.5",
"@superset-ui/legacy-preset-chart-deckgl": "^0.2.3",
"@superset-ui/legacy-preset-chart-nvd3": "^0.13.5",
"@superset-ui/legacy-preset-chart-nvd3": "^0.13.6",
"@superset-ui/number-format": "^0.13.3",
"@superset-ui/plugin-chart-word-cloud": "0.13.5",
"@superset-ui/preset-chart-xy": "^0.13.5",
Expand Down
38 changes: 0 additions & 38 deletions superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,24 +816,6 @@ class SeparatorViz(MarkupViz):
verbose_name = _("Separator")


class WordCloudViz(BaseViz):

"""Build a colorful word cloud

Uses the nice library at:
https://github.com/jasondavies/d3-cloud
"""

viz_type = "word_cloud"
verbose_name = _("Word Cloud")
is_timeseries = False

def query_obj(self):
d = super().query_obj()
d["groupby"] = [self.form_data.get("series")]
return d


class TreemapViz(BaseViz):

"""Tree map visualisation for hierarchical data."""
Expand Down Expand Up @@ -1091,20 +1073,6 @@ def query_obj(self):
d = super().query_obj()
self.metric = form_data.get("metric")

def as_strings(field):
value = form_data.get(field)
return value.split(",") if value else []

def as_floats(field):
return [float(x) for x in as_strings(field)]

self.ranges = as_floats("ranges")
self.range_labels = as_strings("range_labels")
self.markers = as_floats("markers")
self.marker_labels = as_strings("marker_labels")
self.marker_lines = as_floats("marker_lines")
self.marker_line_labels = as_strings("marker_line_labels")

d["metrics"] = [self.metric]
if not self.metric:
raise QueryObjectValidationError(_("Pick a metric to display"))
Expand All @@ -1115,12 +1083,6 @@ def get_data(self, df: pd.DataFrame) -> VizData:
values = df["metric"].values
return {
"measures": values.tolist(),
"ranges": self.ranges or [0, values.max() * 1.1],
"rangeLabels": self.range_labels or None,
"markers": self.markers or None,
"markerLabels": self.marker_labels or None,
"markerLines": self.marker_lines or None,
"markerLineLabels": self.marker_line_labels or None,
}


Expand Down
33 changes: 0 additions & 33 deletions superset/viz_sip38.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,19 +856,6 @@ class SeparatorViz(MarkupViz):
verbose_name = _("Separator")


class WordCloudViz(BaseViz):

"""Build a colorful word cloud

Uses the nice library at:
https://github.com/jasondavies/d3-cloud
"""

viz_type = "word_cloud"
verbose_name = _("Word Cloud")
is_timeseries = False


class TreemapViz(BaseViz):

"""Tree map visualisation for hierarchical data."""
Expand Down Expand Up @@ -1120,20 +1107,6 @@ def query_obj(self):
d = super().query_obj()
self.metric = form_data.get("metric")

def as_strings(field):
value = form_data.get(field)
return value.split(",") if value else []

def as_floats(field):
return [float(x) for x in as_strings(field)]

self.ranges = as_floats("ranges")
self.range_labels = as_strings("range_labels")
self.markers = as_floats("markers")
self.marker_labels = as_strings("marker_labels")
self.marker_lines = as_floats("marker_lines")
self.marker_line_labels = as_strings("marker_line_labels")

d["metrics"] = [self.metric]
if not self.metric:
raise QueryObjectValidationError(_("Pick a metric to display"))
Expand All @@ -1144,12 +1117,6 @@ def get_data(self, df: pd.DataFrame) -> VizData:
values = df["metric"].values
return {
"measures": values.tolist(),
"ranges": self.ranges or [0, values.max() * 1.1],
"rangeLabels": self.range_labels or None,
"markers": self.markers or None,
"markerLabels": self.marker_labels or None,
"markerLines": self.marker_lines or None,
"markerLineLabels": self.marker_line_labels or None,
}


Expand Down