From 7631bd43d67b729e722f5ba26f9b62159879b5df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Barrenechea=20S=C3=A1nchez?= Date: Wed, 13 Dec 2023 16:09:05 +0100 Subject: [PATCH] Area charts: filtered by legend --- .../analysis-chart/impact-chart/component.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/client/src/containers/analysis-chart/impact-chart/component.tsx b/client/src/containers/analysis-chart/impact-chart/component.tsx index e98d77785..147b6063e 100644 --- a/client/src/containers/analysis-chart/impact-chart/component.tsx +++ b/client/src/containers/analysis-chart/impact-chart/component.tsx @@ -140,10 +140,21 @@ const StackedAreaChart: React.FC = ({ indicator }) => { const LEGEND_ROW = rows?.find((row) => row.name === legendKey); + if (legendKey === 'Others' && numberOfAggregatedEntities && numberOfAggregatedEntities > 0) { + result.push({ + date: year, + Others: aggregatedValues?.find((aggregatedValue) => aggregatedValue?.year === year) + ?.value, + ...(aggregatedValues?.isProjected && { + [`projected-${LEGEND_ROW.name}`]: aggregatedValues?.value, + }), + }); + } if (!LEGEND_ROW) return []; if (!LEGEND_ROW?.children.length) { const yearValues = LEGEND_ROW?.values.find((rowValues) => rowValues?.year === year); + result.push({ date: year, [LEGEND_ROW.name]: yearValues?.value,