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: fix: multi deck.gl bug fixes (#7854)
Date Fri, 12 Jul 2019 18:33:27 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 7946165  fix: multi deck.gl bug fixes (#7854)
7946165 is described below

commit 7946165e6ead42b62425dc63d5d109c4722a81ac
Author: Tom Hunter <thunter009@users.noreply.github.com>
AuthorDate: Fri Jul 12 14:33:15 2019 -0400

    fix: multi deck.gl bug fixes (#7854)
    
    * fix: multi deck.gl viewport frozen
    
    add onViewportChange method to handle changes to the viewport
    
    * fix: add max_radius to deck.gl scatter example
    
    - causes multi deck.gl to fail to render scatter without max_radius attribute
---
 superset/assets/src/visualizations/deckgl/Multi/Multi.jsx | 14 ++++++++++----
 superset/data/deck.py                                     |  1 +
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx b/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
index e9da1f7..a0d6225 100644
--- a/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
+++ b/superset/assets/src/visualizations/deckgl/Multi/Multi.jsx
@@ -35,6 +35,7 @@ class DeckMulti extends React.PureComponent {
   constructor(props) {
     super(props);
     this.state = { subSlicesLayers: {} };
+    this.onViewportChange = this.onViewportChange.bind(this);
   }
 
   componentDidMount() {
@@ -47,8 +48,12 @@ class DeckMulti extends React.PureComponent {
     this.loadLayers(formData, payload);
   }
 
-  loadLayers(formData, payload) {
-    this.setState({ subSlicesLayers: {} });
+  onViewportChange(viewport) {
+    this.setState({ viewport });
+  }
+
+  loadLayers(formData, payload, viewport) {
+    this.setState({ subSlicesLayers: {}, viewport });
     payload.data.slices.forEach((subslice) => {
       // Filters applied to multi_deck are passed down to underlying charts
       // note that dashboard contextual information (filter_immune_slices and such) aren't
@@ -86,7 +91,7 @@ class DeckMulti extends React.PureComponent {
   }
 
   render() {
-    const { payload, viewport, formData, setControlValue } = this.props;
+    const { payload, formData, setControlValue } = this.props;
     const { subSlicesLayers } = this.state;
 
     const layers = Object.values(subSlicesLayers);
@@ -94,7 +99,8 @@ class DeckMulti extends React.PureComponent {
     return (
       <DeckGLContainer
         mapboxApiAccessToken={payload.data.mapboxApiKey}
-        viewport={viewport}
+        viewport={this.state.viewport || this.props.viewport}
+        onViewportChange={this.onViewportChange}
         layers={layers}
         mapStyle={formData.mapbox_style}
         setControlValue={setControlValue}
diff --git a/superset/data/deck.py b/superset/data/deck.py
index ab329b0..53445d5 100644
--- a/superset/data/deck.py
+++ b/superset/data/deck.py
@@ -181,6 +181,7 @@ def load_deck_dash():
         "point_radius_fixed": {"type": "metric", "value": "count"},
         "point_unit": "square_m",
         "min_radius": 1,
+        "max_radius": 250,
         "row_limit": 5000,
         "time_range": " : ",
         "size": "count",


Mime
View raw message