betodealmeida commented on a change in pull request #4572: Legend for deck.gl 
scatterplot
URL: 
https://github.com/apache/incubator-superset/pull/4572#discussion_r174321354
 
 

 ##########
 File path: superset/assets/visualizations/Legend.jsx
 ##########
 @@ -0,0 +1,52 @@
+import React from 'react';
+import PropTypes from 'prop-types';
+
+import './Legend.css';
+
+const propTypes = {
+  categories: PropTypes.object,
+  toggleCategory: PropTypes.func,
+  position: PropTypes.oneOf(['tl', 'tr', 'bl', 'br']),
+};
+
+const defaultProps = {
+  categories: {},
+  toggleCategory: () => {},
+  position: 'tr',
+};
+
+export default class Legend extends React.PureComponent {
+  render() {
+    if (Object.keys(this.props.categories).length === 0) {
+      return null;
+    }
+
+    const categories = Object.entries(this.props.categories).map(([k, v]) => {
 
 Review comment:
   Cool. We do have the module `object.entries` (which is a polyfill) included 
as a dependency of a dependency, I'll add it explicitly.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to