From cac3e0977f8f51ba6afa741b78ab6257f369d309 Mon Sep 17 00:00:00 2001 From: lastminutediorama Date: Fri, 20 Dec 2024 13:20:09 -0600 Subject: [PATCH] clean conversions --- .../change-over-time-chart.component.ts | 5 +---- .../treatments/direct-impacts/direct-impacts.component.ts | 5 ++++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.ts b/src/interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.ts index 437036721..965cfdbe1 100644 --- a/src/interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.ts +++ b/src/interface/src/app/treatments/change-over-time-chart/change-over-time-chart.component.ts @@ -152,22 +152,18 @@ export class ChangeOverTimeChartComponent implements OnInit { labels: [0, 5, 10, 15, 20], datasets: [ { - label: data['blue'][0].variable, data: data['blue'].map((d) => d.avg_value), backgroundColor: SLOT_COLORS['blue'], }, { - label: data['purple'][1].variable, data: data['purple'].map((d) => d.avg_value), backgroundColor: SLOT_COLORS['purple'], }, { - label: data['orange'][2].variable, data: data['orange'].map((d) => d.avg_value), backgroundColor: SLOT_COLORS['orange'], }, { - label: data['green'][3].variable, data: data['green'].map((d) => d.avg_value), backgroundColor: SLOT_COLORS['green'], }, @@ -203,6 +199,7 @@ export class ChangeOverTimeChartComponent implements OnInit { ): Record { const chartData = resultData.map((d) => { return { + // map the returned data to data attributes for the map year: d.relative_year, avg_value: d.delta * 100, variable: d.variable, diff --git a/src/interface/src/app/treatments/direct-impacts/direct-impacts.component.ts b/src/interface/src/app/treatments/direct-impacts/direct-impacts.component.ts index 9dd6bd71a..3c9ac9781 100644 --- a/src/interface/src/app/treatments/direct-impacts/direct-impacts.component.ts +++ b/src/interface/src/app/treatments/direct-impacts/direct-impacts.component.ts @@ -136,8 +136,11 @@ export class DirectImpactsComponent implements OnInit, OnDestroy { availableProjectAreas$ = this.treatmentsState.summary$.pipe( map((summary) => { + // TODO: can remove this, in favor of using natsort on backend, + // so "project area 1", "project area 10", "project area 2" + // are sorted in semantic ways return summary?.project_areas.sort( - (a, b) => a.project_area_id - b.project_area_id // TODO: maybe semantic sort on backend? + (a, b) => a.project_area_id - b.project_area_id ); }) );