Skip to content

Commit

Permalink
Area charts: filtered by legend
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarrenechea committed Dec 13, 2023
1 parent 49a9359 commit 7631bd4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions client/src/containers/analysis-chart/impact-chart/component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,21 @@ const StackedAreaChart: React.FC<StackedAreaChartProps> = ({ 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,
Expand Down

0 comments on commit 7631bd4

Please sign in to comment.