mirror of https://github.com/apache/superset.git
chore: move bullet string manipulation to frontend (#9773)
This commit is contained in:
parent
a8d5a8aaa2
commit
f369ab35d6
|
@ -6947,9 +6947,9 @@
|
|||
}
|
||||
},
|
||||
"@superset-ui/legacy-preset-chart-nvd3": {
|
||||
"version": "0.13.5",
|
||||
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.13.5.tgz",
|
||||
"integrity": "sha512-JJ4d8wodQ/Jryy0V/cXG6kqxbtURhDh0/ESnU77FUQwkeX57YK/RlfcL3l/mB6Pu1APuHsxSWe6ZyMIGW1WXIg==",
|
||||
"version": "0.13.9",
|
||||
"resolved": "https://registry.npmjs.org/@superset-ui/legacy-preset-chart-nvd3/-/legacy-preset-chart-nvd3-0.13.9.tgz",
|
||||
"integrity": "sha512-u116cQn+yYXRRcV+UpUEG7pItW2RNykpwhxNq7E/YYQwpCAqquytP70di135OEEx+8Sx6fR17abIQGnmaAS8Fw==",
|
||||
"requires": {
|
||||
"@data-ui/xy-chart": "^0.0.84",
|
||||
"d3": "^3.5.17",
|
||||
|
|
|
@ -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.9",
|
||||
"@superset-ui/number-format": "^0.13.3",
|
||||
"@superset-ui/plugin-chart-word-cloud": "^0.13.9",
|
||||
"@superset-ui/preset-chart-xy": "^0.13.5",
|
||||
|
|
|
@ -1091,20 +1091,6 @@ class BulletViz(NVD3Viz):
|
|||
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"))
|
||||
|
@ -1115,12 +1101,6 @@ class BulletViz(NVD3Viz):
|
|||
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,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1120,20 +1120,6 @@ class BulletViz(NVD3Viz):
|
|||
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"))
|
||||
|
@ -1144,12 +1130,6 @@ class BulletViz(NVD3Viz):
|
|||
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,
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue