From commits-return-703-archive-asf-public=cust-asf.ponee.io@superset.incubator.apache.org Thu Mar 1 00:48:23 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 0739A180657 for ; Thu, 1 Mar 2018 00:48:22 +0100 (CET) Received: (qmail 64349 invoked by uid 500); 28 Feb 2018 23:48:22 -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 64337 invoked by uid 99); 28 Feb 2018 23:48:22 -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; Wed, 28 Feb 2018 23:48:22 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 8C1948266A; Wed, 28 Feb 2018 23:48:21 +0000 (UTC) Date: Wed, 28 Feb 2018 23:48:21 +0000 To: "commits@superset.apache.org" Subject: [incubator-superset] branch master updated: Make margin width based on container width instead of slice width (#4487) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <151986170142.7227.7630280786800581277@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: 764a92cd1094d97aa746f69c51f1285c7034e659 X-Git-Newrev: 3a58dc7ecf9a5d0d669f2576a16fa03c92fe0595 X-Git-Rev: 3a58dc7ecf9a5d0d669f2576a16fa03c92fe0595 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 3a58dc7 Make margin width based on container width instead of slice width (#4487) 3a58dc7 is described below commit 3a58dc7ecf9a5d0d669f2576a16fa03c92fe0595 Author: Jeffrey Wang AuthorDate: Wed Feb 28 18:48:15 2018 -0500 Make margin width based on container width instead of slice width (#4487) * Make width based on container width instead of slice width * fix const var name and add comment * Actually 30 looks good too --- superset/assets/visualizations/nvd3_vis.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js index b60c32a..ef54406 100644 --- a/superset/assets/visualizations/nvd3_vis.js +++ b/superset/assets/visualizations/nvd3_vis.js @@ -18,6 +18,8 @@ import './nvd3_vis.css'; import { VIZ_TYPES } from './main'; const minBarWidth = 15; +// Limit on how large axes margins can grow as the chart window is resized +const maxMarginPad = 30; const animationTime = 1000; const BREAKPOINTS = { @@ -463,7 +465,9 @@ function nvd3Vis(slice, payload) { if (chart.yAxis !== undefined || chart.yAxis2 !== undefined) { // Hack to adjust y axis left margin to accommodate long numbers - const marginPad = isExplore ? width * 0.01 : width * 0.03; + const containerWidth = slice.container.width(); + const marginPad = Math.min(isExplore ? containerWidth * 0.01 : containerWidth * 0.03, + maxMarginPad); const maxYAxisLabelWidth = chart.yAxis2 ? getMaxLabelSize(slice.container, 'nv-y1') : getMaxLabelSize(slice.container, 'nv-y'); const maxXAxisLabelHeight = getMaxLabelSize(slice.container, 'nv-x'); -- To stop receiving notification emails like this one, please contact graceguo@apache.org.