From d586e8e289b2c41bdeeca0588bfc00c3d4f3687b Mon Sep 17 00:00:00 2001 From: Krist Wongsuphasawat Date: Wed, 6 Feb 2019 21:28:30 -0800 Subject: [PATCH] Fix line chart overflowing the right side (#6829) * Fix line chart overflowing the right side * revert package-lock.json * revert again (cherry picked from commit 3f3b7bb9a2372f0e01a8aaa49484afde2bde287d) --- superset/assets/src/visualizations/nvd3/NVD3Vis.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/superset/assets/src/visualizations/nvd3/NVD3Vis.js b/superset/assets/src/visualizations/nvd3/NVD3Vis.js index 1a7230320f0a4..8b99685ada903 100644 --- a/superset/assets/src/visualizations/nvd3/NVD3Vis.js +++ b/superset/assets/src/visualizations/nvd3/NVD3Vis.js @@ -616,8 +616,12 @@ function nvd3Vis(element, props) { margins.right = Math.max(20, maxXAxisLabelHeight / 2) + marginPad; } if (xLabelRotation === 45) { - margins.bottom = maxXAxisLabelHeight + marginPad; - margins.right = maxXAxisLabelHeight + marginPad; + margins.bottom = ( + maxXAxisLabelHeight * Math.sin(Math.PI * xLabelRotation / 180) + ) + marginPad; + margins.right = ( + maxXAxisLabelHeight * Math.cos(Math.PI * xLabelRotation / 180) + ) + marginPad; } else if (staggerLabels) { margins.bottom = 40; }