From f7c55270db9ac757ea8a69596a7a0fc9aff27385 Mon Sep 17 00:00:00 2001 From: Jeff Niu Date: Tue, 2 Jan 2018 17:31:16 -0500 Subject: [PATCH] Remedy for dual axis annotation (#4130) --- superset/assets/visualizations/nvd3_vis.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js index 470f4990945dc..b60c32a0e57c0 100644 --- a/superset/assets/visualizations/nvd3_vis.js +++ b/superset/assets/visualizations/nvd3_vis.js @@ -553,7 +553,7 @@ function nvd3Vis(slice, payload) { } else { xMin = chart.xAxis.scale().domain()[0].valueOf(); xMax = chart.xAxis.scale().domain()[1].valueOf(); - xScale = chart.xScale(); + xScale = chart.xScale ? chart.xScale() : d3.scale.linear(); } if (Array.isArray(formulas) && formulas.length) { @@ -591,8 +591,8 @@ function nvd3Vis(slice, payload) { })); data.push(...formulaData); } - - const annotationHeight = chart.yAxis.scale().range()[0]; + const yAxis = chart.yAxis1 ? chart.yAxis1 : chart.yAxis; + const annotationHeight = yAxis.scale().range()[0]; const tipFactory = layer => d3tip() .attr('class', 'd3-tip') .direction('n')