components/content/content.component.ts
Application main content with Angular material tabs with:
selector | app-content |
imports |
NshmpLibNgDataTablePanelComponent
MatTabGroup
MatTab
MatTabContent
PlotsComponent
|
templateUrl | ./content.component.html |
styleUrl | ./content.component.scss |
Properties |
constructor(service: AppService)
|
||||||
Defined in components/content/content.component.ts:58
|
||||||
Parameters :
|
commonXValues |
Default value : true
|
Defined in components/content/content.component.ts:29
|
Whether the data has common X values |
hasData |
Default value : computed(() => this.service.serviceResponse()?.length > 0)
|
Defined in components/content/content.component.ts:36
|
Whether service has been called and data exists |
meanTable |
Default value : computed(() => {
const plot = this.service.meanPlotState();
return gmmUtils.plotToTable(
plot.plotData,
this.medianExp,
this.commonXValues,
);
})
|
Defined in components/content/content.component.ts:39
|
Table data for mean data |
medianExp |
Default value : true
|
Defined in components/content/content.component.ts:31
|
Whether median data is shown is exponential form |
Public service |
Type : AppService
|
Defined in components/content/content.component.ts:60
|
sigmaExp |
Default value : false
|
Defined in components/content/content.component.ts:33
|
Whether sigma data is shown is exponential form |
sigmaTable |
Default value : computed(() => {
const plot = this.service.sigmaPlotState();
return gmmUtils.plotToTable(
plot.plotData,
this.medianExp,
this.commonXValues,
);
})
|
Defined in components/content/content.component.ts:50
|
Table data for sigma table |
import {Component, computed} from '@angular/core';
import {MatTab, MatTabContent, MatTabGroup} from '@angular/material/tabs';
import {gmmUtils} from '@ghsc/nshmp-lib-ng/gmm';
import {NshmpLibNgDataTablePanelComponent} 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 vs magnitude plot
* - Median data tab: table with GMM vs magnitude median data
* - Sigma data tab: table with GMM vs magnitude sigma data
*/
@Component({
imports: [
NshmpLibNgDataTablePanelComponent,
MatTabGroup,
MatTab,
MatTabContent,
PlotsComponent,
],
selector: 'app-content',
styleUrl: './content.component.scss',
templateUrl: './content.component.html',
})
export class ContentComponent {
/** Whether the data has common X values */
commonXValues = true;
/** Whether median data is shown is exponential form */
medianExp = true;
/** Whether sigma data is shown is exponential form */
sigmaExp = false;
/** Whether service has been called and data exists */
hasData = computed(() => this.service.serviceResponse()?.length > 0);
/** Table data for mean data */
meanTable = computed(() => {
const plot = this.service.meanPlotState();
return gmmUtils.plotToTable(
plot.plotData,
this.medianExp,
this.commonXValues,
);
});
/** Table data for sigma table */
sigmaTable = computed(() => {
const plot = this.service.sigmaPlotState();
return gmmUtils.plotToTable(
plot.plotData,
this.medianExp,
this.commonXValues,
);
});
constructor(public service: AppService) {}
}
<mat-tab-group class="height-full">
<!-- Plots tab -->
<mat-tab labelClass="plots-tab" label="Plots">
<ng-template matTabContent>
<app-plots />
</ng-template>
</mat-tab>
<!-- Median data tab -->
<mat-tab
labelClass="medians-tab"
label="Medians"
[disabled]="hasData() === false"
>
<ng-template matTabContent>
<nshmp-lib-ng-data-table-panel
[table]="meanTable()"
filename="gmm-magnitude-means.csv"
buttonText="Export Means as CSV"
title="Median Data"
/>
</ng-template>
</mat-tab>
<!-- Sigma data tab -->
<mat-tab
labelClass="sigmas-tab"
label="Sigmas"
[disabled]="hasData() === false"
>
<ng-template matTabContent>
<nshmp-lib-ng-data-table-panel
[table]="sigmaTable()"
filename="gmm-magnitude-sigmas.csv"
buttonText="Export Sigmas as CSV"
title="Sigma Data"
/>
</ng-template>
</mat-tab>
</mat-tab-group>