betodealmeida closed pull request #5932: Allow removing legend
URL: https://github.com/apache/incubator-superset/pull/5932
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/superset/assets/src/explore/controls.jsx
b/superset/assets/src/explore/controls.jsx
index 2b7bce8d36..86ac9f5cbb 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 57bd430dc9..41f60b9bbd 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)}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]