mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 22:40:39 +08:00
20 lines
418 B
TypeScript
20 lines
418 B
TypeScript
/* eslint-disable no-restricted-syntax */
|
|
import { ChartData } from 'chart.js';
|
|
|
|
export const hasData = (data: ChartData): boolean => {
|
|
const { datasets = [] } = data;
|
|
let hasData = false;
|
|
try {
|
|
for (const dataset of datasets) {
|
|
if (dataset.data.length > 0 && dataset.data.some((item) => item !== 0)) {
|
|
hasData = true;
|
|
break;
|
|
}
|
|
}
|
|
} catch (error) {
|
|
console.error(error);
|
|
}
|
|
|
|
return hasData;
|
|
};
|