mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
BarChart: fix single numeric field regression (#31703)
This commit is contained in:
parent
c15d1f498a
commit
c64c0b0725
@ -48,21 +48,14 @@ export const BarChartPanel: React.FunctionComponent<Props> = ({
|
||||
}
|
||||
|
||||
const firstFrame = data.series[0];
|
||||
if (!firstFrame.fields.find((f) => f.type === FieldType.string)) {
|
||||
if (!firstFrame.fields.some((f) => f.type === FieldType.string)) {
|
||||
return (
|
||||
<div className="panel-empty">
|
||||
<p>Bar charts requires a string field</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
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 (
|
||||
<div className="panel-empty">
|
||||
<p>No numeric fields found</p>
|
||||
|
Loading…
Reference in New Issue
Block a user