From c64c0b07252277df2ed5cd0ffcec7a81d19d454a Mon Sep 17 00:00:00 2001 From: Leon Sorokin Date: Thu, 4 Mar 2021 14:27:14 -0600 Subject: [PATCH] BarChart: fix single numeric field regression (#31703) --- public/app/plugins/panel/barchart/BarChartPanel.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/public/app/plugins/panel/barchart/BarChartPanel.tsx b/public/app/plugins/panel/barchart/BarChartPanel.tsx index a420e4b45ef..0f4c72de883 100755 --- a/public/app/plugins/panel/barchart/BarChartPanel.tsx +++ b/public/app/plugins/panel/barchart/BarChartPanel.tsx @@ -48,21 +48,14 @@ export const BarChartPanel: React.FunctionComponent = ({ } const firstFrame = data.series[0]; - if (!firstFrame.fields.find((f) => f.type === FieldType.string)) { + if (!firstFrame.fields.some((f) => f.type === FieldType.string)) { return (

Bar charts requires a string field

); } - if ( - firstFrame.fields.reduce((acc, f) => { - if (f.type === FieldType.number) { - return acc + 1; - } - return acc; - }, 0) < 2 - ) { + if (!firstFrame.fields.some((f) => f.type === FieldType.number)) { return (

No numeric fields found