bugfixing

This commit is contained in:
MuslemRahimi 2025-01-09 11:36:23 +01:00
parent a4076d14c1
commit f2763c6e32

View File

@ -15,7 +15,6 @@
import { CanvasRenderer } from "echarts/renderers"; import { CanvasRenderer } from "echarts/renderers";
export let data; export let data;
use([ use([
LineChart, LineChart,
GaugeChart, GaugeChart,
@ -57,9 +56,7 @@
while (year > 0) { while (year > 0) {
// Ensure we don't loop indefinitely // Ensure we don't loop indefinitely
// Find the index where the item's date matches the current year and revenue is null // Find the index where the item's date matches the current year and revenue is null
const index = data?.findIndex( const index = data?.findIndex((item) => item?.date === year);
(item) => item?.date === year && item?.revenue === null,
);
// If index is found and there is at least one item in the data for this year with non-null revenue // If index is found and there is at least one item in the data for this year with non-null revenue
if (index !== -1) { if (index !== -1) {