mirror of https://github.com/apache/superset.git
Allow removing legend (#5932)
This commit is contained in:
parent
b9e3159f7c
commit
71f014e9b6
|
@ -259,6 +259,7 @@ export const controls = {
|
||||||
clearable: false,
|
clearable: false,
|
||||||
default: 'tr',
|
default: 'tr',
|
||||||
choices: [
|
choices: [
|
||||||
|
[null, 'None'],
|
||||||
['tl', 'Top left'],
|
['tl', 'Top left'],
|
||||||
['tr', 'Top right'],
|
['tr', 'Top right'],
|
||||||
['bl', 'Bottom left'],
|
['bl', 'Bottom left'],
|
||||||
|
|
|
@ -7,7 +7,7 @@ const propTypes = {
|
||||||
categories: PropTypes.object,
|
categories: PropTypes.object,
|
||||||
toggleCategory: PropTypes.func,
|
toggleCategory: PropTypes.func,
|
||||||
showSingleCategory: PropTypes.func,
|
showSingleCategory: PropTypes.func,
|
||||||
position: PropTypes.oneOf(['tl', 'tr', 'bl', 'br']),
|
position: PropTypes.oneOf([null, 'tl', 'tr', 'bl', 'br']),
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
|
@ -19,7 +19,7 @@ const defaultProps = {
|
||||||
|
|
||||||
export default class Legend extends React.PureComponent {
|
export default class Legend extends React.PureComponent {
|
||||||
render() {
|
render() {
|
||||||
if (Object.keys(this.props.categories).length === 0) {
|
if (Object.keys(this.props.categories).length === 0 || this.props.position === null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ export default class Legend extends React.PureComponent {
|
||||||
const style = { color: 'rgba(' + v.color.join(', ') + ')' };
|
const style = { color: 'rgba(' + v.color.join(', ') + ')' };
|
||||||
const icon = v.enabled ? '\u25CF' : '\u25CB';
|
const icon = v.enabled ? '\u25CF' : '\u25CB';
|
||||||
return (
|
return (
|
||||||
<li>
|
<li key={k}>
|
||||||
<a
|
<a
|
||||||
href="#"
|
href="#"
|
||||||
onClick={() => this.props.toggleCategory(k)}
|
onClick={() => this.props.toggleCategory(k)}
|
||||||
|
|
Loading…
Reference in New Issue