diff --git a/superset/assets/src/explore/constants.js b/superset/assets/src/explore/constants.js index 711ef086ee..468d02f5c2 100644 --- a/superset/assets/src/explore/constants.js +++ b/superset/assets/src/explore/constants.js @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ export const AGGREGATES = { AVG: 'AVG', COUNT: 'COUNT ', 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/explore/index.jsx b/superset/assets/src/explore/index.jsx index 3088170f01..f2547e79a3 100644 --- a/superset/assets/src/explore/index.jsx +++ b/superset/assets/src/explore/index.jsx @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; diff --git a/superset/assets/src/explore/validators.js b/superset/assets/src/explore/validators.js index ebf4271ae4..a38df3f4cf 100644 --- a/superset/assets/src/explore/validators.js +++ b/superset/assets/src/explore/validators.js @@ -1,3 +1,21 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ /* Reusable validator functions used in controls definitions * * validator functions receive the v and the configuration of the control 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
