This is an automated email from the ASF dual-hosted git repository.
beto 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 8773fdc [bugfix] Fix deck_polygon metric bug and update examples
chart (#8025)
8773fdc is described below
commit 8773fdceb283c5ad830918e9b81ac2fbe2269bdf
Author: Ville Brofeldt <[email protected]>
AuthorDate: Thu Aug 15 19:20:49 2019 +0300
[bugfix] Fix deck_polygon metric bug and update examples chart (#8025)
* Fix deck_polygon bug and update examples chart
* Change js elevation to native ad-hoc metric
* Move scale from metric to native multiplier
* Remove redundant js_columns and change color scheme
---
superset/examples/deck.py | 50 ++++++++++++++++++++++++++++++++++++++---------
superset/viz.py | 4 +++-
2 files changed, 44 insertions(+), 10 deletions(-)
diff --git a/superset/examples/deck.py b/superset/examples/deck.py
index 6cd0441..f90689d 100644
--- a/superset/examples/deck.py
+++ b/superset/examples/deck.py
@@ -335,8 +335,30 @@ def load_deck_dash():
"time_grain_sqla": None,
"time_range": " : ",
"line_column": "contour",
- "metric": None,
+ "metric": {
+ "aggregate": "SUM",
+ "column": {
+ "column_name": "population",
+ "description": None,
+ "expression": None,
+ "filterable": True,
+ "groupby": True,
+ "id": 1332,
+ "is_dttm": False,
+ "optionName": "_col_population",
+ "python_date_format": None,
+ "type": "BIGINT",
+ "verbose_name": None,
+ },
+ "expressionType": "SIMPLE",
+ "fromFormData": True,
+ "hasCustomLabel": True,
+ "label": "Population",
+ "optionName": "metric_t2v4qbfiz1_w6qgpx4h2p",
+ "sqlExpression": None,
+ },
"line_type": "json",
+ "linear_color_scheme": "oranges",
"mapbox_style": "mapbox://styles/mapbox/light-v9",
"viewport": {
"longitude": -122.43388541747726,
@@ -360,16 +382,26 @@ def load_deck_dash():
"filled": True,
"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"
- " elevation: d.extraProps.population/d.extraProps.area/10,\n"
- "}));",
+ "multiplier": 0.1,
+ "point_radius_fixed": {
+ "type": "metric",
+ "value": {
+ "aggregate": None,
+ "column": None,
+ "expressionType": "SQL",
+ "fromFormData": None,
+ "hasCustomLabel": None,
+ "label": "Density",
+ "optionName": "metric_c5rvwrzoo86_293h6yrv2ic",
+ "sqlExpression": "SUM(population)/SUM(area)",
+ },
+ },
+ "js_columns": [],
+ "js_data_mutator": "",
"js_tooltip": "",
"js_onclick_href": "",
+ "legend_format": ".1s",
+ "legend_position": "tr",
"where": "",
"having": "",
"filters": [],
diff --git a/superset/viz.py b/superset/viz.py
index ae4b0a7..cecfe2d 100644
--- a/superset/viz.py
+++ b/superset/viz.py
@@ -2434,7 +2434,9 @@ class DeckPolygon(DeckPathViz):
fd = self.form_data
elevation = fd["point_radius_fixed"]["value"]
type_ = fd["point_radius_fixed"]["type"]
- d["elevation"] = d.get(elevation["label"]) if type_ == "metric" else
elevation
+ d["elevation"] = (
+ d.get(utils.get_metric_name(elevation)) if type_ == "metric" else
elevation
+ )
return d