From 8800bd79df875f8da31049a42e834c733f8accee Mon Sep 17 00:00:00 2001 From: Yilei Cai Date: Tue, 9 May 2017 14:47:17 -0700 Subject: [PATCH] fix dual line chart margin --- superset/assets/visualizations/nvd3_vis.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js index aa49d437f560b..d1c601f249b7a 100644 --- a/superset/assets/visualizations/nvd3_vis.js +++ b/superset/assets/visualizations/nvd3_vis.js @@ -406,10 +406,11 @@ function nvd3Vis(slice, payload) { .style('fill-opacity', 1); } - if (chart.yAxis !== undefined) { + 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 maxYAxisLabelWidth = getMaxLabelSize(slice.container, 'nv-y'); + const maxYAxisLabelWidth = chart.yAxis2 ? getMaxLabelSize(slice.container, 'nv-y1') + : getMaxLabelSize(slice.container, 'nv-y'); const maxXAxisLabelHeight = getMaxLabelSize(slice.container, 'nv-x'); chart.margin({ left: maxYAxisLabelWidth + marginPad }); if (fd.y_axis_label && fd.y_axis_label !== '') {