From commits-return-1540-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Tue Sep 18 19:30:55 2018 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 [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 0EF2A180672 for ; Tue, 18 Sep 2018 19:30:54 +0200 (CEST) Received: (qmail 74808 invoked by uid 500); 18 Sep 2018 17:30:54 -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 74797 invoked by uid 99); 18 Sep 2018 17:30:53 -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; Tue, 18 Sep 2018 17:30:53 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 6DC17829C2; Tue, 18 Sep 2018 17:30:53 +0000 (UTC) Date: Tue, 18 Sep 2018 17:30:53 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: [bugfix] Fix percent metric display and check for string columns in table (#5917) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <153729185320.4380.3032117518150510960@gitbox.apache.org> From: graceguo@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: f2d64492efb3d1b76bb60b9305def9d06b4d5567 X-Git-Newrev: 19a3319acfc1e88dd8a66cd0f03386e394174ac4 X-Git-Rev: 19a3319acfc1e88dd8a66cd0f03386e394174ac4 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. graceguo 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 19a3319 [bugfix] Fix percent metric display and check for string columns in table (#5917) 19a3319 is described below commit 19a3319acfc1e88dd8a66cd0f03386e394174ac4 Author: Krist Wongsuphasawat AuthorDate: Tue Sep 18 10:30:47 2018 -0700 [bugfix] Fix percent metric display and check for string columns in table (#5917) * fix percent metric display * add empty line * address string or number check --- superset/assets/src/visualizations/table.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/superset/assets/src/visualizations/table.js b/superset/assets/src/visualizations/table.js index a875aad..2b20a7d 100644 --- a/superset/assets/src/visualizations/table.js +++ b/superset/assets/src/visualizations/table.js @@ -46,6 +46,7 @@ const propTypes = { }; const formatValue = d3.format('0,000'); +const formatPercent = d3.format('.3p'); function NOOP() {} function TableVis(element, props) { @@ -76,7 +77,7 @@ function TableVis(element, props) { // Add percent metrics .concat((percentMetrics || []).map(m => '%' + m)) // Removing metrics (aggregates) that are strings - .filter(m => !Number.isNaN(data[0][m])); + .filter(m => (typeof data[0][m]) === 'number'); function col(c) { const arr = []; @@ -131,9 +132,11 @@ function TableVis(element, props) { } if (isMetric) { html = d3.format(format || '0.3s')(val); - } else if (key[0] === '%') { - html = d3.format('.3p')(val); } + if (key[0] === '%') { + html = formatPercent(val); + } + return { col: key, val,