Skip to content

Commit

Permalink
[bugfix] Fix deck_polygon metric bug and update examples chart (apach…
Browse files Browse the repository at this point in the history
…e#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
  • Loading branch information
villebro authored and betodealmeida committed Aug 15, 2019
1 parent ed8bb1b commit 8773fdc
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
50 changes: 41 additions & 9 deletions superset/examples/deck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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": [],
Expand Down
4 changes: 3 additions & 1 deletion superset/viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -2434,7 +2434,9 @@ def get_properties(self, d):
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


Expand Down

0 comments on commit 8773fdc

Please sign in to comment.