Explorar o código

💄 allow to diplay scenario where suitable

jmacura %!s(int64=3) %!d(string=hai) anos
pai
achega
23453157b6

+ 12 - 6
src/app/discs-chart/disc.component.ts

@@ -15,7 +15,7 @@ export class DiscComponent implements OnInit, AfterViewInit {
   @Input() factor = 'aggregated';
   @Input() region: string;
   @Input() scenario = 'baseline';
-  @Input() show: 'name' | 'factor' = 'name';
+  @Input() show: 'name' | 'factor' | 'scenario' = 'name';
   divId = 'graph-place';
   private arrowUse;
   private regionData;
@@ -120,11 +120,17 @@ export class DiscComponent implements OnInit, AfterViewInit {
       .attr('x', 0)
       .attr('y', -60)
       .attr('dy', '.35em')
-      .text((d) =>
-        this.show == 'name'
-          ? d['MODEL']
-          : this.factor.split('/').slice(-1).pop()
-      )
+      .text((d) => {
+        switch (this.show) {
+          case 'factor':
+            return this.factor.split('/').pop();
+          case 'scenario':
+            return this.scenario;
+          case 'name':
+          default:
+            return d['MODEL'];
+        }
+      })
       .style('text-anchor', 'middle');
     this.svgContentText = this.svgContent.append('text');
     this.svgContentText

+ 2 - 2
src/app/discs-chart/scenario-year-graph/scenario-year-graph.component.html

@@ -10,9 +10,9 @@
   </select-->
   <h4>Aggregated RAI</h4>
   <div class="d-flex">
-    <disc [region]="region" show="factor"></disc>
+    <disc [region]="region" show="scenario"></disc>
     <div *ngFor="let scenario of filteredScenarios">
-      <disc [region]="region" [scenario]="scenario" show="factor"></disc>
+      <disc [region]="region" [scenario]="scenario" show="scenario"></disc>
     </div>
   </div>
 </div>