|
|
@@ -1,74 +0,0 @@
|
|
|
-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';
|
|
|
-
|
|
|
-@Component({
|
|
|
- selector: 'scenario-year-graph',
|
|
|
- templateUrl: './scenario-year-graph.component.html',
|
|
|
- styleUrls: ['./scenario-year-graph.component.scss'],
|
|
|
-})
|
|
|
-export class ScenarioYearGraphComponent implements OnInit {
|
|
|
- @Input() region: string;
|
|
|
- @Input() domain: string;
|
|
|
- filteredScenarios = [];
|
|
|
-
|
|
|
- constructor(
|
|
|
- public sdmDihService: SdmDihService,
|
|
|
- public yearGraphService: YearGraphService
|
|
|
- ) {}
|
|
|
-
|
|
|
- ngOnInit() {
|
|
|
- this.sdmDihService.dataLoads.subscribe((loaded) => {
|
|
|
- if (!loaded) {
|
|
|
- return;
|
|
|
- }
|
|
|
- this.filterScenarios();
|
|
|
- });
|
|
|
- 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() {
|
|
|
- const MILLISECONDS_TO_ANIMATE = 100 as const;
|
|
|
- let i = 1;
|
|
|
- for (const year of this.sdmDihService.years) {
|
|
|
- setTimeout(() => {
|
|
|
- this.yearGraphService.selectedYear = year;
|
|
|
- this.yearGraphService.redrawGraphs();
|
|
|
- }, MILLISECONDS_TO_ANIMATE * i);
|
|
|
- i++;
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
- /*nextYear() {
|
|
|
- const selectedYearIndex = this.sdmDihService.years.findIndex(
|
|
|
- (val) => val == this.yearGraphService.selectedYear
|
|
|
- );
|
|
|
- this.yearGraphService.selectedYear =
|
|
|
- this.sdmDihService.years[selectedYearIndex + 1] ??
|
|
|
- this.yearGraphService.selectedYear;
|
|
|
- this.yearGraphService.redrawGraphs();
|
|
|
- }*/
|
|
|
-
|
|
|
- /*prevYear() {
|
|
|
- const selectedYearIndex = this.sdmDihService.years.findIndex(
|
|
|
- (val) => val == this.yearGraphService.selectedYear
|
|
|
- );
|
|
|
- this.yearGraphService.selectedYear =
|
|
|
- this.sdmDihService.years[selectedYearIndex - 1] ??
|
|
|
- this.yearGraphService.selectedYear;
|
|
|
- this.yearGraphService.redrawGraphs();
|
|
|
- }*/
|
|
|
-}
|