components/plots/plots.component.ts
Disaggregation plot with select menu of component.
selector | app-plots |
imports |
NshmpLibNgHazardDisaggPlotComponent
MatButton
MatDivider
MatFormField
MatLabel
MatSelect
MatOption
AsyncPipe
ReactiveFormsModule
MatSliderModule
FormsModule
|
templateUrl | ./plots.component.html |
styleUrl | ./plots.component.scss |
Properties |
|
Methods |
constructor(service: AppService, templateService: NshmpTemplateService)
|
|||||||||
Defined in components/plots/plots.component.ts:42
|
|||||||||
Parameters :
|
exportReport |
exportReport()
|
Defined in components/plots/plots.component.ts:50
|
Print report
Returns :
void
|
disaggData |
Default value : this.service.disaggData
|
Defined in components/plots/plots.component.ts:38
|
Disaggregation response data state |
form |
Default value : this.service.formGroup
|
Defined in components/plots/plots.component.ts:40
|
Form field state |
Public service |
Type : AppService
|
Defined in components/plots/plots.component.ts:45
|
serviceResponse |
Default value : this.service.serviceResponse
|
Defined in components/plots/plots.component.ts:42
|
Disaggreagtion service response |
Public templateService |
Type : NshmpTemplateService
|
Defined in components/plots/plots.component.ts:46
|
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,
}"
/>