superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject [incubator-superset] branch master updated: Allow removing legend (#5932)
Date Wed, 19 Sep 2018 20:32:13 GMT
This is an automated email from the ASF dual-hosted git repository.

beto pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 71f014e  Allow removing legend (#5932)
71f014e is described below

commit 71f014e9b69c5961fd091b4d29b6de5aceeb4bca
Author: Beto Dealmeida <roberto@dealmeida.net>
AuthorDate: Wed Sep 19 13:32:07 2018 -0700

    Allow removing legend (#5932)
---
 superset/assets/src/explore/controls.jsx      | 1 +
 superset/assets/src/visualizations/Legend.jsx | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/superset/assets/src/explore/controls.jsx b/superset/assets/src/explore/controls.jsx
index 2b7bce8..86ac9f5 100644
--- a/superset/assets/src/explore/controls.jsx
+++ b/superset/assets/src/explore/controls.jsx
@@ -259,6 +259,7 @@ export const controls = {
     clearable: false,
     default: 'tr',
     choices: [
+      [null, 'None'],
       ['tl', 'Top left'],
       ['tr', 'Top right'],
       ['bl', 'Bottom left'],
diff --git a/superset/assets/src/visualizations/Legend.jsx b/superset/assets/src/visualizations/Legend.jsx
index 57bd430..41f60b9 100644
--- a/superset/assets/src/visualizations/Legend.jsx
+++ b/superset/assets/src/visualizations/Legend.jsx
@@ -7,7 +7,7 @@ const propTypes = {
   categories: PropTypes.object,
   toggleCategory: PropTypes.func,
   showSingleCategory: PropTypes.func,
-  position: PropTypes.oneOf(['tl', 'tr', 'bl', 'br']),
+  position: PropTypes.oneOf([null, 'tl', 'tr', 'bl', 'br']),
 };
 
 const defaultProps = {
@@ -19,7 +19,7 @@ const defaultProps = {
 
 export default class Legend extends React.PureComponent {
   render() {
-    if (Object.keys(this.props.categories).length === 0) {
+    if (Object.keys(this.props.categories).length === 0 || this.props.position === null)
{
       return null;
     }
 
@@ -27,7 +27,7 @@ export default class Legend extends React.PureComponent {
       const style = { color: 'rgba(' + v.color.join(', ') + ')' };
       const icon = v.enabled ? '\u25CF' : '\u25CB';
       return (
-        <li>
+        <li key={k}>
           <a
             href="#"
             onClick={() => this.props.toggleCategory(k)}


Mime
View raw message