superset-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maximebeauche...@apache.org
Subject [incubator-superset] branch master updated: [wip] fix: multi deck.gl bug fixes (pt 2) (#7866)
Date Sat, 13 Jul 2019 21:25:20 GMT
This is an automated email from the ASF dual-hosted git repository.

maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 1197d25  [wip] fix: multi deck.gl bug fixes (pt 2) (#7866)
1197d25 is described below

commit 1197d25c3cec37217c5ac99b58746b97a91959c9
Author: Tom Hunter <thunter009@users.noreply.github.com>
AuthorDate: Sat Jul 13 17:25:04 2019 -0400

    [wip] fix: multi deck.gl bug fixes (pt 2) (#7866)
    
    * fix: update polygon example data to work with multi deck.gl
    
    - both "point_radius_fixed" and "multiplier" attributes were not set during load_examples
so these charts were failing when viewing as a multi deck.gl chart
    
    * fix: unify deck.gl getLayers api to fix multi deck.gl tooltips
    
    - various deck.gl layers implemented getLayers slightly differently which caused issues
with generating default tooltips when the layers are viewed in a multi deck.gl chart
    
    * fix: cleanup formData variable in scatter chart for consistency
    
    * linting fix + polygon regression fix
    
    * additional linting fixes
---
 superset/assets/src/visualizations/deckgl/Multi/Multi.jsx   | 13 +++++++++++++
 .../src/visualizations/deckgl/layers/Polygon/Polygon.jsx    |  3 ++-
 .../src/visualizations/deckgl/layers/Scatter/Scatter.jsx    |  3 ++-
 .../visualizations/deckgl/layers/Screengrid/Screengrid.jsx  |  2 +-
 superset/data/deck.py                                       |  2 ++
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx b/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
index a0d6225..b511eaa 100644
--- a/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
+++ b/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
@@ -29,6 +29,14 @@ const propTypes = {
   payload: PropTypes.object.isRequired,
   setControlValue: PropTypes.func.isRequired,
   viewport: PropTypes.object.isRequired,
+  onAddFilter: PropTypes.func,
+  setTooltip: PropTypes.func,
+  onSelect: PropTypes.func,
+};
+const defaultProps = {
+  onAddFilter() {},
+  setTooltip() {},
+  onSelect() {},
 };
 
 class DeckMulti extends React.PureComponent {
@@ -78,6 +86,10 @@ class DeckMulti extends React.PureComponent {
           const layer = layerGenerators[subsliceCopy.form_data.viz_type](
             subsliceCopy.form_data,
             json,
+            this.props.onAddFilter,
+            this.props.setTooltip,
+            [],
+            this.props.onSelect,
           );
           this.setState({
             subSlicesLayers: {
@@ -110,5 +122,6 @@ class DeckMulti extends React.PureComponent {
 }
 
 DeckMulti.propTypes = propTypes;
+DeckMulti.defaultProps = defaultProps;
 
 export default DeckMulti;
diff --git a/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx b/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx
index 7e30668..3797d7e 100644
--- a/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx
+++ b/superset/assets/src/visualizations/deckgl/layers/Polygon/Polygon.jsx
@@ -61,7 +61,7 @@ function setTooltipContent(formData) {
   };
 }
 
-export function getLayer(formData, payload, setTooltip, selected, onSelect, filters) {
+export function getLayer(formData, payload, onAddFilter, setTooltip, selected, onSelect,
filters) {
   const fd = formData;
   const fc = fd.fill_color_picker;
   const sc = fd.stroke_color_picker;
@@ -236,6 +236,7 @@ class DeckGLPolygon extends React.Component {
     const layer = getLayer(
       this.props.formData,
       this.props.payload,
+      this.props.onAddFilter,
       this.props.setTooltip,
       this.state.selected,
       this.onSelect,
diff --git a/superset/assets/src/visualizations/deckgl/layers/Scatter/Scatter.jsx b/superset/assets/src/visualizations/deckgl/layers/Scatter/Scatter.jsx
index 8ca13aa..add107d 100644
--- a/superset/assets/src/visualizations/deckgl/layers/Scatter/Scatter.jsx
+++ b/superset/assets/src/visualizations/deckgl/layers/Scatter/Scatter.jsx
@@ -42,7 +42,8 @@ function setTooltipContent(formData) {
   );
 }
 
-export function getLayer(fd, payload, onAddFilter, setTooltip) {
+export function getLayer(formData, payload, onAddFilter, setTooltip) {
+  const fd = formData;
   const dataWithRadius = payload.data.features.map((d) => {
     let radius = unitToRadius(fd.point_unit, d.radius) || 10;
     if (fd.multiplier) {
diff --git a/superset/assets/src/visualizations/deckgl/layers/Screengrid/Screengrid.jsx b/superset/assets/src/visualizations/deckgl/layers/Screengrid/Screengrid.jsx
index 1efefae..d9fba4c 100644
--- a/superset/assets/src/visualizations/deckgl/layers/Screengrid/Screengrid.jsx
+++ b/superset/assets/src/visualizations/deckgl/layers/Screengrid/Screengrid.jsx
@@ -41,7 +41,7 @@ function setTooltipContent(o) {
   );
 }
 
-export function getLayer(formData, payload, onAddFilter, setTooltip, filters) {
+export function getLayer(formData, payload, onAddFilter, setTooltip, selected, onSelect,
filters) {
   const fd = formData;
   const c = fd.color_picker;
   let data = payload.data.features.map(d => ({
diff --git a/superset/data/deck.py b/superset/data/deck.py
index 53445d5..974be90 100644
--- a/superset/data/deck.py
+++ b/superset/data/deck.py
@@ -361,6 +361,8 @@ def load_deck_dash():
         "stroked": False,
         "extruded": True,
         "point_radius_scale": 100,
+        "point_radius_fixed": {"type": "metric", "value": "count"},
+        "multiplier": 1,
         "js_columns": ["population", "area"],
         "js_data_mutator": "data => data.map(d => ({\n"
         "    ...d,\n"


Mime
View raw message