File

components/plots/plots.component.ts

Description

Disaggregation plot with select menu of component.

Metadata

Index

Properties
Methods

Constructor

constructor(service: AppService, templateService: NshmpTemplateService)
Parameters :
Name Type Optional
service AppService No
templateService NshmpTemplateService No

Methods

exportReport
exportReport()

Print report

Returns : void

Properties

disaggData
Default value : this.service.disaggData

Disaggregation response data state

form
Default value : this.service.formGroup

Form field state

Public service
Type : AppService
serviceResponse
Default value : this.service.serviceResponse

Disaggreagtion service response

Public templateService
Type : NshmpTemplateService
import {AsyncPipe} from '@angular/common';
import {Component} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {MatButton} from '@angular/material/button';
import {MatOption} from '@angular/material/core';
import {MatDivider} from '@angular/material/divider';
import {MatFormField, MatLabel} from '@angular/material/form-field';
import {MatSelect} from '@angular/material/select';
import {MatSliderModule} from '@angular/material/slider';
import {NshmpLibNgHazardDisaggPlotComponent} from '@ghsc/nshmp-lib-ng/hazard';
import {NshmpTemplateService} from '@ghsc/nshmp-template';

import {AppService} from '../../services/app.service';

/**
 * Disaggregation plot with select menu of component.
 */
@Component({
  imports: [
    NshmpLibNgHazardDisaggPlotComponent,
    MatButton,
    MatDivider,
    MatFormField,
    MatLabel,
    MatSelect,
    MatOption,
    AsyncPipe,
    ReactiveFormsModule,
    MatSliderModule,
    FormsModule,
  ],
  selector: 'app-plots',
  styleUrl: './plots.component.scss',
  templateUrl: './plots.component.html',
})
export class PlotsComponent {
  /** Disaggregation response data state */
  disaggData = this.service.disaggData;
  /** Form field state */
  form = this.service.formGroup;
  /** Disaggreagtion service response */
  serviceResponse = this.service.serviceResponse;

  constructor(
    public service: AppService,
    public templateService: NshmpTemplateService,
  ) {}

  /** Print report */
  exportReport(): void {
    print();
  }
}
<div class="grid-row grid-gap print-display-none">
  <!-- Print report button -->
  <div>
    <button
      mat-raised-button
      color="primary"
      [disabled]="disaggData() === null"
      (click)="exportReport()"
    >
      Print Report (PDF)
    </button>
  </div>

  <!-- Export summary button -->
  <div>
    <button
      class="export-button"
      mat-raised-button
      color="primary"
      [disabled]="disaggData() === null"
      (click)="service.saveSummaryReport()"
    >
      Save Report (TXT)
    </button>
  </div>
</div>

<mat-divider />

<!-- Select component -->
<mat-form-field
  class="grid-col-12 padding-top-4 disagg-component-select print-display-none"
>
  <mat-label> Component </mat-label>
  <mat-select
    [formControl]="form.controls.disaggComponent"
    [panelClass]="[
      (templateService.isSmallScreen$ | async) ? 'small-screen' : '',
      'disagg-component-select-overlay',
    ]"
  >
    @for (disagg of disaggData()?.data; track disagg) {
      <mat-option [value]="disagg?.component">
        {{ disagg?.component }}
      </mat-option>
    }
  </mat-select>
</mat-form-field>

<!-- Disagg plot -->
<nshmp-lib-ng-hazard-disagg-plot
  #disaggPlot
  [inputs]="{
    component: form.value.disaggComponent,
    imt: form.value.imt,
    responseData: serviceResponse()?.response,
  }"
/>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""