Skip to content
Snippets Groups Projects
app.component.ts 1.02 KiB
Newer Older
  • Learn to ignore specific revisions
  • Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
    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';
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
    import { nshmpHaz } from '@ghsc/nshmp-utils';
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
    import * as deagg from '../assets/deagg.json';
    
    
    @Component({
      selector: 'app-root',
      templateUrl: './app.component.html',
      styleUrls: ['./app.component.scss'],
    })
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
    export class AppComponent implements AfterViewInit {
      title = 'Disaggregation';
    
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
      data = deagg.response as nshmpHaz.disaggService.DisaggResponseData;
    
    
      @ViewChild('example')
      el: ElementRef<HTMLElement>;
    
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
      constructor() {}
    
    
      ngAfterViewInit(): void {
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
        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,