You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2018/11/19 22:02:08 UTC
[GitHub] mistercrunch closed pull request #6365: [bugfix] deckgl legend is
not interactive
mistercrunch closed pull request #6365: [bugfix] deckgl legend is not interactive
URL: https://github.com/apache/incubator-superset/pull/6365
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/visualizations/deckgl/CategoricalDeckGLContainer.jsx b/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx
index c3b9ccc1c1..dd88f70b49 100644
--- a/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx
+++ b/superset/assets/src/visualizations/deckgl/CategoricalDeckGLContainer.jsx
@@ -52,8 +52,7 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
*/
constructor(props) {
super(props);
-
- this.state = CategoricalDeckGLContainer.getDerivedStateFromProps(props);
+ this.state = this.getInitialStateFromProps(props);
this.getLayers = this.getLayers.bind(this);
this.onValuesChange = this.onValuesChange.bind(this);
@@ -61,7 +60,17 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
this.toggleCategory = this.toggleCategory.bind(this);
this.showSingleCategory = this.showSingleCategory.bind(this);
}
- static getDerivedStateFromProps(props, state) {
+ onValuesChange(values) {
+ this.setState({
+ values: Array.isArray(values)
+ ? values
+ : [values, values + this.state.getStep(values)],
+ });
+ }
+ onViewportChange(viewport) {
+ this.setState({ viewport });
+ }
+ getInitialStateFromProps(props, state) {
const features = props.payload.data.features || [];
const timestamps = features.map(f => f.__timestamp);
const categories = getCategories(props.formData, features);
@@ -106,16 +115,6 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
categories,
};
}
- onValuesChange(values) {
- this.setState({
- values: Array.isArray(values)
- ? values
- : [values, values + this.state.getStep(values)],
- });
- }
- onViewportChange(viewport) {
- this.setState({ viewport });
- }
getLayers(values) {
const {
getLayer,
@@ -171,15 +170,19 @@ export default class CategoricalDeckGLContainer extends React.PureComponent {
}
toggleCategory(category) {
const categoryState = this.state.categories[category];
- categoryState.enabled = !categoryState.enabled;
- const categories = { ...this.state.categories, [category]: categoryState };
+ const categories = {
+ ...this.state.categories,
+ [category]: {
+ ...categoryState,
+ enabled: !categoryState.enabled,
+ },
+ };
// if all categories are disabled, enable all -- similar to nvd3
if (Object.values(categories).every(v => !v.enabled)) {
/* eslint-disable no-param-reassign */
Object.values(categories).forEach((v) => { v.enabled = true; });
}
-
this.setState({ categories });
}
showSingleCategory(category) {
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org