From e1ae6bf53eeabfde022ced1d716bd2ab7e55b853 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 24 Mar 2020 09:21:31 -0700 Subject: [PATCH 1/2] feat: more helpful error --- .../src/HorizonChart.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx b/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx index 833aeba3d..5dab10a19 100644 --- a/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx +++ b/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx @@ -78,6 +78,8 @@ class HorizonChart extends React.PureComponent { yDomain = d3Extent(allValues, d => d.y); } + if (data.length <= 1) throw 'Please select a "Group by" option to enable multiple rows.'; + return (
{data.map(row => ( From 7cc2ea202bacb86cba3d3a8a73b9ef1ff37ff230 Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Tue, 24 Mar 2020 09:39:58 -0700 Subject: [PATCH 2/2] fix: fixing linting error about throwing literlal errors --- .../src/HorizonChart.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx b/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx index 5dab10a19..b323cbb5b 100644 --- a/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx +++ b/packages/superset-ui-legacy-plugin-chart-horizon/src/HorizonChart.jsx @@ -78,7 +78,8 @@ class HorizonChart extends React.PureComponent { yDomain = d3Extent(allValues, d => d.y); } - if (data.length <= 1) throw 'Please select a "Group by" option to enable multiple rows.'; + if (data.length <= 1) + throw new Error('Please select a "Group by" option to enable multiple rows.'); return (