From 112a2b7abda23dd4732faff2c84397b92f769754 Mon Sep 17 00:00:00 2001 From: Beto Dealmeida Date: Thu, 3 Jan 2019 11:36:59 -0800 Subject: [PATCH] Add FSA to deck.gl Polygon (cherry picked from commit 600d5808e91312960323f165d02c09e1bafe64d2) (cherry picked from commit 1fe113a34aa79b4a2bb2d9ddd412ad4244e82081) (cherry picked from commit f56b291148c8bc446fb38c78d63b1b5554b58b82) (cherry picked from commit 66e8955902c78c0f2e8d8f1f99cf8a5505c4aeef) --- .../components/controls/SpatialControl.jsx | 25 ++++++++ superset/assets/src/explore/controls.jsx | 1 + .../visualizations/deckgl/layers/common.jsx | 2 +- superset/viz.py | 64 ++++++++++++++++++- 4 files changed, 89 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/explore/components/controls/SpatialControl.jsx b/superset/assets/src/explore/components/controls/SpatialControl.jsx index 9d38fca36a151..16d21a0d1b63f 100644 --- a/superset/assets/src/explore/components/controls/SpatialControl.jsx +++ b/superset/assets/src/explore/components/controls/SpatialControl.jsx @@ -33,6 +33,7 @@ const spatialTypes = { delimited: 'delimited', geohash: 'geohash', zipcode: 'zipcode', + fsa: 'fsa', }; const propTypes = { @@ -65,6 +66,7 @@ export default class SpatialControl extends React.Component { reverseCheckbox: v.reverseCheckbox || false, geohashCol: v.geohashCol || defaultCol, zipcodeCol: v.zipcodeCol || defaultCol, + fsaCol: v.fsaCol || defaultCol, value: null, errors: [], }; @@ -105,6 +107,12 @@ export default class SpatialControl extends React.Component { if (!value.zipcodeCol) { errors.push(errMsg); } + } else if (type === spatialTypes.fsa) { + value.fsaCol = this.state.fsaCol; + value.reverseCheckbox = this.state.reverseCheckbox; + if (!value.fsaCol) { + errors.push(errMsg); + } } this.setState({ value, errors }); this.props.onChange(value, errors); @@ -130,6 +138,8 @@ export default class SpatialControl extends React.Component { return `${this.state.geohashCol}`; } else if (this.state.type === spatialTypes.zipcode) { return `${this.state.zipcodeCol}`; + } else if (this.state.type === spatialTypes.fsa) { + return `${this.state.fsaCol}`; } return null; } @@ -224,6 +234,21 @@ export default class SpatialControl extends React.Component { + + + + Column + {this.renderSelect('fsaCol', spatialTypes.fsa)} + + + {this.renderReverseCheckbox()} + + +