From dd2af3faa855c0f89b5921f708c876b018ce3a3c Mon Sep 17 00:00:00 2001 From: Erik Ritter Date: Mon, 29 Jul 2019 13:56:22 -0700 Subject: [PATCH] fix: nvd3 charts break on stateChange dispatch (#159) --- .../superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js index 12545cc2ade47..78a818070595c 100644 --- a/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js +++ b/superset-frontend/temporary_superset_ui/superset-ui/plugins/superset-ui-plugins/packages/superset-ui-legacy-preset-chart-nvd3/src/NVD3Vis.js @@ -654,7 +654,9 @@ function nvd3Vis(element, props) { applyYAxisBounds(); // Also reapply on each state change to account for enabled/disabled series - chart.dispatch.on('stateChange.applyYAxisBounds', applyYAxisBounds); + if (chart.dispatch && chart.dispatch.stateChange) { + chart.dispatch.on('stateChange.applyYAxisBounds', applyYAxisBounds); + } // align yAxis1 and yAxis2 ticks if (isVizTypes(['dual_line', 'line_multi'])) {