Explorar el Código

💬 improve naming of things

jmacura hace 3 años
padre
commit
d2ddece69a

+ 2 - 0
src/app/discs-chart/discs.module.ts

@@ -7,6 +7,7 @@ import {DiscLegendComponent} from './disc-legend.component';
 import {FactorYearDiscComponent} from './factor-year-graph/factor-year-disc.component';
 import {FactorYearGraphComponent} from './factor-year-graph/factor-year-graph.component';
 import {FilterPipe} from './filter.pipe';
+import {NiceNamePipe} from './nice-name.pipe';
 import {QuarterPipe} from './quarter.pipe';
 import {ScenarioFactorYearDiscComponent} from './scenario-factor-year-graph/scenario-factor-year-disc.component';
 import {ScenarioFactorYearGraphComponent} from './scenario-factor-year-graph/scenario-factor-year-graph.component';
@@ -31,6 +32,7 @@ import {YearGraphComponent} from './year-graph/year-graph.component';
     ScenarioFactorYearDiscComponent,
     ScenarioFactorYearGraphComponent,
     FilterPipe,
+    NiceNamePipe,
     QuarterPipe,
   ],
   providers: [],

+ 12 - 0
src/app/discs-chart/nice-name.pipe.ts

@@ -0,0 +1,12 @@
+import {Pipe, PipeTransform} from '@angular/core';
+
+import abbreviationMap from '../../assets/data/abbreviation-map.json';
+
+@Pipe({
+  name: 'niceName',
+})
+export class NiceNamePipe implements PipeTransform {
+  transform(value: any, ...args: any[]): any {
+    return abbreviationMap[value] ?? value;
+  }
+}

+ 7 - 3
src/app/discs-chart/scenario-factor-year-graph/scenario-factor-year-graph.component.html

@@ -1,14 +1,16 @@
 <div class="card">
   <h2>Comparison of different scenarios</h2>
   <div *ngIf="sdmDihService.yearsLoaded; else loading" class="card-body">
+    region
     <select [(ngModel)]="selectedRegion" (ngModelChange)="yearGraphService.redrawGraphs({region: selectedRegion})">
       <ng-container *ngFor="let region of sdmDihService.regions">
         <option [ngValue]="region">{{region}}</option>
       </ng-container>
     </select>
+    &emsp;&amp;&nbsp;domain
     <select [(ngModel)]="selectedDomain" (ngModelChange)="yearGraphService.redrawGraphs({domain: selectedDomain})">
       <ng-container *ngFor="let domain of sdmDihService.domains | filter:baselineFilter">
-        <option [ngValue]="domain">{{domain}}</option>
+        <option [ngValue]="domain">{{domain | niceName}}</option>
       </ng-container>
     </select>
     <div class="year-range">
@@ -34,7 +36,8 @@
 
     <div class="d-flex">
       <div class="discs-caption">
-        <h4>"Business as usual" scenario</h4>
+        <h4>business as usual</h4>
+        <p>scenario</p>
         <p>
           of region {{selectedRegion}} in {{yearGraphService.selectedYear}}
         </p>
@@ -49,7 +52,8 @@
     <div *ngFor="let scenario of filteredScenarios; last as isLast">
       <div class="d-flex">
         <div class="discs-caption">
-          <h4>{{scenario}} scenario</h4>
+          <h4>{{scenario | niceName}}</h4>
+          <p>scenario</p>
           <p>
             of region {{selectedRegion}} in {{yearGraphService.selectedYear}}
           </p>

+ 1 - 1
src/assets/data/abbreviation-map.json

@@ -10,7 +10,7 @@
   "AGRI": "agriculture policy",
   "AGRI Focus AKIS": "investment only into the agric. innovation & knowledge system (AKIS)",
   "AGRI Focus Eco-Schemes": "investment only into eco-schemes",
-  "AGRI mix": "investment into AKIS & Eco-Schemes",
+  "AGRI Mix": "investment into AKIS & Eco-Schemes",
   "ENTRP": "support to Entrepreneurship",
   "ENTRP High": "high rate of support to entrepreneurs",
   "ENTRP Medium": "medium rate of support to entrepreneurs",