From commits-return-3014-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Thu Aug 15 16:21:10 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id B1CE6180645 for ; Thu, 15 Aug 2019 18:21:09 +0200 (CEST) Received: (qmail 57957 invoked by uid 500); 15 Aug 2019 16:21:09 -0000 Mailing-List: contact commits-help@superset.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@superset.incubator.apache.org Delivered-To: mailing list commits@superset.incubator.apache.org Received: (qmail 57948 invoked by uid 99); 15 Aug 2019 16:21:09 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Aug 2019 16:21:09 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id CCE9585F42; Thu, 15 Aug 2019 16:21:08 +0000 (UTC) Date: Thu, 15 Aug 2019 16:21:08 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [bugfix] Fix deck_polygon metric bug and update examples chart (#8025) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <156588606792.16466.8790500033958533186@gitbox.apache.org> From: beto@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: incubator-superset X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: ed8bb1b694e95df661bb99ff877097d749a0c9e0 X-Git-Newrev: 8773fdceb283c5ad830918e9b81ac2fbe2269bdf X-Git-Rev: 8773fdceb283c5ad830918e9b81ac2fbe2269bdf X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated 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 <33317356+villebro@users.noreply.github.com> 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