Newer
Older
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { nshmpHaz } from '@ghsc/nshmp-web-utils';
import { DisaggGraphView, Disaggregation, DisaggResponse } from '@nshmp/disagg-d3/src/disagg';
import { Collection } from '@nshmp/disagg-d3/src/mvc';
@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>;
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,