import { Component, ViewChild, ElementRef, OnInit, AfterViewInit } from '@angular/core'; import { DisaggResponse, Disaggregation, DisaggGraphView } from '@nshmp/disagg-d3/src/disagg'; import { Collection } from '@nshmp/disagg-d3/src/mvc'; import { nshmpHaz } from '@ghsc/nshmp-utils'; import * as deagg from '../assets/deagg.json'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'], }) export class AppComponent implements AfterViewInit { title = 'Disaggregation'; data = deagg.response as nshmpHaz.disaggService.DisaggResponseData; @ViewChild('example') el: ElementRef<HTMLElement>; constructor() {} ngAfterViewInit(): void { const response = new DisaggResponse(this.data); const deaggs = response.get<Collection<Disaggregation>>('disaggregations').data(); const collection = new Collection(deaggs); collection.select(collection.data()[0]); const view = new DisaggGraphView({ el: this.el.nativeElement, collection, }); } }