From eaa24256ea5a287e3021b628e5be352a54ab1da0 Mon Sep 17 00:00:00 2001 From: Kim Truong <47833996+khtruong@users.noreply.github.com> Date: Mon, 8 Apr 2019 15:24:02 -0700 Subject: [PATCH] fix: y-axis bounds for stacked viz types (#45) * fix: y-axis bounds for stacked viz types * fix: add dist_bar --- .../superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js b/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js index 82edafadc1..de9ee0c504 100644 --- a/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js +++ b/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js @@ -619,7 +619,13 @@ function nvd3Vis(element, props) { yMin = min; yMax = max; } else { - const [trueMin, trueMax] = computeYDomain(data); + let [trueMin, trueMax] = [0, 1]; + // These viz types can be stacked + if (isVizTypes(['area', 'bar', 'dist_bar'])) { + [trueMin, trueMax] = chart.yAxis.scale().domain(); + } else { + [trueMin, trueMax] = computeYDomain(data); + } yMin = hasCustomMin ? min : trueMin; yMax = hasCustomMax ? max : trueMax; }