File

components/plot-settings-panel/plot-settings-panel.component.ts

Description

Plot settings panel.

Metadata

Index

Properties
Methods

Constructor

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

Methods

updatePlot
updatePlot(id: string, plot: NshmpPlot)
Parameters :
Name Type Optional
id string No
plot NshmpPlot No
Returns : void

Properties

plots
Default value : computed<PlotSettingsPlots[]>(() => { const plot = this.service.mfdPlotState(); const defaultPlot = this.service.defaultPlots().get(Plots.MFD); return [ { defaultPlotSetting: defaultPlot.settingsForm.getRawValue(), plot, updatePlot: plot => this.updatePlot(Plots.MFD, plot), }, ]; })
Public service
Type : AppService
import {Component, computed} from '@angular/core';
import {
  NshmpLibNgPlotSettingsExpansionPanelComponent,
  NshmpPlot,
  PlotSettingsPlots,
} from '@ghsc/nshmp-lib-ng/plot';

import {Plots} from '../../models/plots.model';
import {AppService} from '../../services/app.service';

/**
 * Plot settings panel.
 */
@Component({
  imports: [NshmpLibNgPlotSettingsExpansionPanelComponent],
  selector: 'app-plot-settings-panel',
  styleUrl: './plot-settings-panel.component.scss',
  templateUrl: './plot-settings-panel.component.html',
})
export class PlotSettingsPanelComponent {
  plots = computed<PlotSettingsPlots[]>(() => {
    const plot = this.service.mfdPlotState();
    const defaultPlot = this.service.defaultPlots().get(Plots.MFD);

    return [
      {
        defaultPlotSetting: defaultPlot.settingsForm.getRawValue(),
        plot,
        updatePlot: plot => this.updatePlot(Plots.MFD, plot),
      },
    ];
  });

  constructor(public service: AppService) {}

  updatePlot(id: string, plot: NshmpPlot): void {
    const plots = new Map(this.service.plots());
    plots.set(id, plot);
    this.service.updateState({
      plots,
    });
  }
}
<nshmp-lib-ng-plot-settings-expansion-panel [plots]="plots()" />
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""