From ddaa8df1c5542bee9e3866a54491b4f783a35a03 Mon Sep 17 00:00:00 2001 From: Aaryan Khandelwal <65252264+aaryan610@users.noreply.github.com> Date: Sat, 24 Jun 2023 00:35:00 +0530 Subject: [PATCH] fix: progress chart to show ideal line only when data is present (#1384) --- .../core/sidebar/progress-chart.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/apps/app/components/core/sidebar/progress-chart.tsx b/apps/app/components/core/sidebar/progress-chart.tsx index 47af406cc..8c7dba11e 100644 --- a/apps/app/components/core/sidebar/progress-chart.tsx +++ b/apps/app/components/core/sidebar/progress-chart.tsx @@ -93,16 +93,19 @@ const ProgressChart: React.FC = ({ distribution, startDate, endDate, tota id: "ideal", color: "#a9bbd0", fill: "transparent", - data: [ - { - x: chartData[0].currentDate, - y: totalIssues, - }, - { - x: chartData[chartData.length - 1].currentDate, - y: 0, - }, - ], + data: + chartData.length > 0 + ? [ + { + x: chartData[0].currentDate, + y: totalIssues, + }, + { + x: chartData[chartData.length - 1].currentDate, + y: 0, + }, + ] + : [], }, ]} layers={["grid", "markers", "areas", DashedLine, "slices", "points", "axes", "legends"]}