components/plot-settings-panel/plot-settings-panel.component.ts
Plot settings panel.
selector | app-plot-settings-panel |
imports |
NshmpLibNgPlotSettingsExpansionPanelComponent
|
templateUrl | ./plot-settings-panel.component.html |
styleUrl | ./plot-settings-panel.component.scss |
Properties |
Methods |
constructor(service: AppService)
|
||||||
Parameters :
|
updatePlot | ||||||
updatePlot(plot: NshmpPlot)
|
||||||
Parameters :
Returns :
void
|
Public service |
Type : AppService
|
import {Component, computed} from '@angular/core';
import {gmmUtils} from '@ghsc/nshmp-lib-ng/gmm';
import {
NshmpLibNgPlotSettingsExpansionPanelComponent,
NshmpPlot,
PlotSettingsPlots,
} from '@ghsc/nshmp-lib-ng/plot';
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.meanPlotState();
const defaultPlot = this.service
.defaultPlots()
.get(gmmUtils.PlotType.MEANS);
return [
{
defaultPlotSetting: defaultPlot.settingsForm.getRawValue(),
plot,
updatePlot: plot => this.updatePlot(plot),
},
];
});
constructor(public service: AppService) {}
updatePlot(plot: NshmpPlot): void {
const plots = new Map(this.service.state().plots);
plots.set(gmmUtils.PlotType.MEANS, plot);
this.service.updateState({
plots,
});
}
}
<nshmp-lib-ng-plot-settings-expansion-panel [plots]="plots()" />