|
|
@@ -1,5 +1,6 @@
|
|
|
import {Component, Input, OnInit} from '@angular/core';
|
|
|
|
|
|
+import domain2scenario from '../../../assets/data/domain-scenario.json';
|
|
|
import {SdmDihService} from '../../sdm-dih.service';
|
|
|
import {YearGraphService} from '../year-graph.service';
|
|
|
|
|
|
@@ -11,23 +12,35 @@ import {YearGraphService} from '../year-graph.service';
|
|
|
export class ScenarioFactorYearGraphComponent implements OnInit {
|
|
|
@Input() region: string;
|
|
|
@Input() domain: string;
|
|
|
+ filteredScenarios = [];
|
|
|
+
|
|
|
constructor(
|
|
|
public sdmDihService: SdmDihService,
|
|
|
public yearGraphService: YearGraphService
|
|
|
) {}
|
|
|
|
|
|
ngOnInit() {
|
|
|
+ this.filterScenarios();
|
|
|
this.sdmDihService.dataLoads.subscribe((loaded) => {
|
|
|
if (!loaded) {
|
|
|
return;
|
|
|
}
|
|
|
});
|
|
|
- this.yearGraphService.graphRefreshes.subscribe(() => {
|
|
|
- //unused
|
|
|
+ this.yearGraphService.graphRefreshes.subscribe(({domain}) => {
|
|
|
+ if (domain) {
|
|
|
+ this.domain = domain;
|
|
|
+ }
|
|
|
+ this.filterScenarios();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ filterScenarios(): void {
|
|
|
+ this.filteredScenarios = this.sdmDihService.scenarios.filter((scenario) => {
|
|
|
+ return domain2scenario[this.domain].includes(scenario);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- animateGraphs() {
|
|
|
+ /*animateGraphs() {
|
|
|
const MILLISECONDS_TO_ANIMATE = 100 as const;
|
|
|
let i = 1;
|
|
|
for (const year of this.sdmDihService.years) {
|
|
|
@@ -37,9 +50,9 @@ export class ScenarioFactorYearGraphComponent implements OnInit {
|
|
|
}, MILLISECONDS_TO_ANIMATE * i);
|
|
|
i++;
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- nextYear() {
|
|
|
+ /*nextYear() {
|
|
|
const selectedYearIndex = this.sdmDihService.years.findIndex(
|
|
|
(val) => val == this.yearGraphService.selectedYear
|
|
|
);
|
|
|
@@ -47,9 +60,9 @@ export class ScenarioFactorYearGraphComponent implements OnInit {
|
|
|
this.sdmDihService.years[selectedYearIndex + 1] ??
|
|
|
this.yearGraphService.selectedYear;
|
|
|
this.yearGraphService.redrawGraphs();
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
- prevYear() {
|
|
|
+ /*prevYear() {
|
|
|
const selectedYearIndex = this.sdmDihService.years.findIndex(
|
|
|
(val) => val == this.yearGraphService.selectedYear
|
|
|
);
|
|
|
@@ -57,5 +70,5 @@ export class ScenarioFactorYearGraphComponent implements OnInit {
|
|
|
this.sdmDihService.years[selectedYearIndex - 1] ??
|
|
|
this.yearGraphService.selectedYear;
|
|
|
this.yearGraphService.redrawGraphs();
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|