You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by gr...@apache.org on 2018/02/28 23:48:21 UTC
[incubator-superset] branch master updated: Make margin width based
on container width instead of slice width (#4487)
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 <je...@gmail.com>
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.