components/content/content.component.ts
Application main content with Angular material tabs with:
| changeDetection | ChangeDetectionStrategy.OnPush |
| host | { |
| selector | app-content |
| imports |
MatTabGroup
MatTab
PlotsComponent
NshmpDataTablePanelComponent
NshmpScrollToTopComponent
MatTabContent
|
| templateUrl | ./content.component.html |
| styleUrl | ./content.component.scss |
Properties |
| commonXValues |
Default value : true
|
|
Defined in components/content/content.component.ts:32
|
|
Whether the data has common X values |
| exp |
Default value : true
|
|
Defined in components/content/content.component.ts:34
|
|
Whether data is shown is exponential form |
| hasData |
Default value : computed(() => this.service.serviceResponse()?.length > 0)
|
|
Defined in components/content/content.component.ts:37
|
|
Whether service has been called and data exists |
| service |
Default value : inject(AppService)
|
|
Defined in components/content/content.component.ts:29
|
| table |
Default value : computed(() =>
this.service.meanPlotState().toTableData({commonXValues: this.commonXValues, exp: this.exp}),
)
|
|
Defined in components/content/content.component.ts:40
|
|
Table data for table |
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 vs distance plot
* - Data tab: table with GMM vs distance data
*/
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
host: {id: 'gmm-distance-content'},
imports: [
MatTabGroup,
MatTab,
PlotsComponent,
NshmpDataTablePanelComponent,
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 data is shown is exponential form */
exp = true;
/** Whether service has been called and data exists */
hasData = computed(() => this.service.serviceResponse()?.length > 0);
/** Table data for table */
table = computed(() =>
this.service.meanPlotState().toTableData({commonXValues: this.commonXValues, exp: this.exp}),
);
}
<mat-tab-group class="height-full">
<!-- Plots tab -->
<mat-tab labelClass="plots-tab" label="Plots">
<nshmp-scroll-to-top>
<app-plots />
</nshmp-scroll-to-top>
</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]="table()"
filename="gmm-distance-means.csv"
buttonText="Export Means to CSV"
title="Median Data"
/>
</div>
</ng-template>
</mat-tab>
</mat-tab-group>