components/content/content.component.ts
Application main content with Angular material tabs with:
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| selector | app-content |
| imports |
NshmpDataTablePanelComponent
MatTabGroup
MatTab
PlotsComponent
NshmpScrollToTopComponent
MatTabContent
|
| templateUrl | ./content.component.html |
| styleUrl | ./content.component.scss |
Properties |
| commonXValues |
Default value : true
|
|
Defined in components/content/content.component.ts:33
|
|
Whether the data has common X values |
| hasData |
Default value : computed(() => this.service.serviceResponse()?.length > 0)
|
|
Defined in components/content/content.component.ts:42
|
|
Whether service has been called and data exists |
| padValues |
Default value : true
|
|
Defined in components/content/content.component.ts:35
|
|
Whether to pad values |
| service |
Default value : inject(AppService)
|
|
Defined in components/content/content.component.ts:30
|
| sigmaExp |
Default value : false
|
|
Defined in components/content/content.component.ts:37
|
|
Whether sigma data is shown is exponential form |
| sigmaTable |
Default value : computed(() => {
const plot = this.service.sigmaPlotState();
const xAll = this.service.state().xValues;
return plot.toTableData({
commonXValues: this.commonXValues,
exp: this.sigmaExp,
padValues: this.padValues,
xAll,
});
})
|
|
Defined in components/content/content.component.ts:45
|
|
Table data for sigma |
| spectraExp |
Default value : true
|
|
Defined in components/content/content.component.ts:39
|
|
Whether spectra data is shown is exponential form |
| spectraTable |
Default value : computed(() => {
const plot = this.service.spectraPlotState();
const xAll = this.service.state().xValues;
return plot.toTableData({
commonXValues: this.commonXValues,
exp: this.spectraExp,
padValues: this.padValues,
xAll,
});
})
|
|
Defined in components/content/content.component.ts:58
|
|
Table data for mean |
import {ChangeDetectionStrategy, Component, computed, inject} from '@angular/core';
import {MatTab, MatTabContent, MatTabGroup} from '@angular/material/tabs';
import {NshmpDataTablePanelComponent, NshmpScrollToTopComponent} from '@ghsc/nshmp-lib-ng/nshmp';
import {AppService} from '../../services/app.service';
import {PlotsComponent} from '../plots/plots.component';
/**
* Application main content with Angular material tabs with:
* - Plots tab: GMM response spectra plot
* - Median data tab: table with response spectra median data
* - Sigma data tab: table with response spectra sigma data
*/
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
host: {id: 'gmm-spectra-content'},
imports: [
NshmpDataTablePanelComponent,
MatTabGroup,
MatTab,
PlotsComponent,
NshmpScrollToTopComponent,
MatTabContent,
],
selector: 'app-content',
styleUrl: './content.component.scss',
templateUrl: './content.component.html',
})
export class ContentComponent {
service = inject(AppService);
/** Whether the data has common X values */
commonXValues = true;
/** Whether to pad values */
padValues = true;
/** Whether sigma data is shown is exponential form */
sigmaExp = false;
/** Whether spectra data is shown is exponential form */
spectraExp = true;
/** Whether service has been called and data exists */
hasData = computed(() => this.service.serviceResponse()?.length > 0);
/** Table data for sigma */
sigmaTable = computed(() => {
const plot = this.service.sigmaPlotState();
const xAll = this.service.state().xValues;
return plot.toTableData({
commonXValues: this.commonXValues,
exp: this.sigmaExp,
padValues: this.padValues,
xAll,
});
});
/** Table data for mean */
spectraTable = computed(() => {
const plot = this.service.spectraPlotState();
const xAll = this.service.state().xValues;
return plot.toTableData({
commonXValues: this.commonXValues,
exp: this.spectraExp,
padValues: this.padValues,
xAll,
});
});
}
<mat-tab-group class="height-full">
<!-- Plots tab -->
<mat-tab labelClass="plots-tab" label="Plots">
<ng-template matTabContent>
<nshmp-scroll-to-top>
<app-plots />
</nshmp-scroll-to-top>
</ng-template>
</mat-tab>
<!-- Median data tab -->
<mat-tab labelClass="medians-tab" label="Medians" [disabled]="hasData() === false">
<ng-template matTabContent>
<div class="grid-container-widescreen">
<nshmp-data-table-panel
[table]="spectraTable()"
filename="spectra-medians.csv"
buttonText="Export Medians as CSV"
title="Median Data"
/>
</div>
</ng-template>
</mat-tab>
<!-- Sigma data tab -->
<mat-tab labelClass="sigmas-tab" label="Sigmas" [disabled]="hasData() === false">
<ng-template matTabContent>
<div class="grid-container-widescreen">
<nshmp-data-table-panel
[table]="sigmaTable()"
filename="spectra-sigmas.csv"
buttonText="Export Sigmas as CSV"
title="Sigma Data"
/>
</div>
</ng-template>
</mat-tab>
</mat-tab-group>