superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [incubator-superset] Diff for: [GitHub] yi-bai closed pull request #6691: allowed bubble size to be empty
Date Tue, 15 Jan 2019 08:49:50 GMT
diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index f0efeef8c9..22df43a563 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -1132,6 +1132,7 @@ export const controls = {
     ...metric,
     label: t('Bubble Size'),
     default: null,
+    validators: [],
   },
 
   url: {
diff --git a/superset/assets/src/visualizations/nvd3/utils.js b/superset/assets/src/visualizations/nvd3/utils.js
index 60bd2dc372..43eb8a27c4 100644
--- a/superset/assets/src/visualizations/nvd3/utils.js
+++ b/superset/assets/src/visualizations/nvd3/utils.js
@@ -144,7 +144,9 @@ export function generateBubbleTooltipContent({
   );
   s += createHTMLRow(getLabel(xField), xFormatter(point.x));
   s += createHTMLRow(getLabel(yField), yFormatter(point.y));
-  s += createHTMLRow(getLabel(sizeField), sizeFormatter(point.size));
+  if (sizeField) {
+    s += createHTMLRow(getLabel(sizeField), sizeFormatter(point.size));
+  }
   s += '</table>';
   return s;
 }
diff --git a/superset/viz.py b/superset/viz.py
index 9318cb730b..e244fb82fb 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -951,11 +951,11 @@ def query_obj(self):
         self.series = form_data.get('series') or self.entity
         d['row_limit'] = form_data.get('limit')
 
-        d['metrics'] = [
-            self.z_metric,
-            self.x_metric,
-            self.y_metric,
-        ]
+        d['metrics'] = []
+        if self.z_metric:
+            d['metrics'].append(self.z_metric)
+        d['metrics'].append(self.x_metric)
+        d['metrics'].append(self.y_metric)
         if not all(d['metrics'] + [self.entity]):
             raise Exception(_('Pick a metric for x, y and size'))
         return d
@@ -963,7 +963,8 @@ def query_obj(self):
     def get_data(self, df):
         df['x'] = df[[utils.get_metric_name(self.x_metric)]]
         df['y'] = df[[utils.get_metric_name(self.y_metric)]]
-        df['size'] = df[[utils.get_metric_name(self.z_metric)]]
+        # Bubble size is fixed to 1 if bubble size is not calculated
+        df['size'] = df[[utils.get_metric_name(self.z_metric)]] if self.z_metric else 1
         df['shape'] = 'circle'
         df['group'] = df[[self.series]]
 


With regards,
Apache Git Services

Mime
View raw message