File

components/content/content.component.ts

Description

Application main content with Angular material tabs with:

  • Plots tab: GMM vs distance plot
  • Data tab: table with GMM vs distance data

Metadata

Index

Properties

Constructor

constructor(service: AppService)
Parameters :
Name Type Optional
service AppService No

Properties

commonXValues
Default value : true

Whether the data has common X values

exp
Default value : true

Whether data is shown is exponential form

hasData
Default value : computed(() => this.service.serviceResponse()?.length > 0)

Whether service has been called and data exists

Public service
Type : AppService
table
Default value : computed(() => gmmUtils.plotToTable( this.service.meanPlotState().plotData, this.exp, this.commonXValues, ), )

Table data for 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 distance plot
 *  - Data tab: table with GMM vs distance data
 */
@Component({
  imports: [
    MatTabGroup,
    MatTab,
    MatTabContent,
    PlotsComponent,
    NshmpLibNgDataTablePanelComponent,
  ],
  selector: 'app-content',
  styleUrl: './content.component.scss',
  templateUrl: './content.component.html',
})
export class ContentComponent {
  /** 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(() =>
    gmmUtils.plotToTable(
      this.service.meanPlotState().plotData,
      this.exp,
      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]="table()"
        filename="gmm-distance-means.csv"
        buttonText="Export Means to CSV"
        title="Median Data"
      />
    </ng-template>
  </mat-tab>
</mat-tab-group>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""