[GitHub] betodealmeida commented on a change in pull request #4572: Legend for deck.gl scatterplot
betodealmeida commented on a change in pull request #4572: Legend for deck.gl scatterplot URL: https://github.com/apache/incubator-superset/pull/4572#discussion_r174322258 ## File path: superset/assets/visualizations/deckgl/layers/scatter.jsx ## @@ -68,8 +89,10 @@ function getLayer(formData, payload, slice, inFrame) { data = jsFnMutator(data); } - if (inFrame != null) { -data = data.filter(inFrame); + if (filters != null) { +filters.forEach((f) => { + data = data.filter(f); Review comment: Functional JS! ;) Maybe we should call this `postFilters` or something similar, since it's a series of filters applied after the query (due to clicks from the legend or the play slider). 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
[GitHub] betodealmeida commented on a change in pull request #4572: Legend for deck.gl scatterplot
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
[GitHub] betodealmeida commented on a change in pull request #4572: Legend for deck.gl scatterplot
betodealmeida commented on a change in pull request #4572: Legend for deck.gl scatterplot URL: https://github.com/apache/incubator-superset/pull/4572#discussion_r173347009 ## File path: superset/assets/visualizations/Legend.jsx ## @@ -0,0 +1,42 @@ +import React from 'react'; +import PropTypes from 'prop-types'; + +import './Legend.css'; + +const propTypes = { + categories: PropTypes.object, + toggleCategory: PropTypes.func, +}; + +const defaultProps = { + categories: {}, + toggleCategory: () => {}, +}; + +export default class Legend extends React.PureComponent { Review comment: My idea was to use this as a legend for all visualization types that don't have a native one (like nvd3 has). Right now this component takes only a list of categories and is not specific to maps. 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