File

lib/models/nshmp-plot.model.ts

Description

Plot settings.

Index

Properties

Properties

config
config: Partial<PlotlyConfig>
Type : Partial<PlotlyConfig>

Plot config settings

layout
layout: LayoutSettings
Type : LayoutSettings

Plot layout settings

import {FormControl, FormGroup} from '@angular/forms';
import {FormGroupControls} from '@ghsc/nshmp-lib-ng/nshmp';
import {PlotlyConfig, PlotlyPlot} from '@ghsc/nshmp-utils-ts/libs/plotly';
import {AxisType} from 'plotly.js';

/**
 * Plot axis settings.
 */
export interface AxisSettings {
  /** Number of ticks */
  nticks: number;
  /** Axis title settings */
  title: TitleSettings;
  /** Axis type */
  type: AxisType;
}

/**
 * Plot layout settings
 */
export interface LayoutSettings {
  /** Plot aspect ratio */
  aspectRatio: string;
  /** Legend settings */
  legend: LegendSettings;
  /** Plot title settings */
  title: TitleSettings;
  /** X axis settings */
  xaxis: AxisSettings;
  /** Y axis settings */
  yaxis: AxisSettings;
}

/**
 * Plot legend settings
 */
export interface LegendSettings {
  /** Whether to show legend */
  showlegend: boolean;
  /** X location of legend */
  x: number;
  /** Y location of legend */
  y: number;
}

export interface AxisFormGroup {
  nticks: FormControl<number>;
  title: FormGroupControls<TitleSettings>;
  type: FormControl<AxisType>;
}

export interface NshmpPlotLayoutFormGroup {
  aspectRatio: FormControl<string>;
  legend: FormGroupControls<LegendSettings>;
  title: FormGroupControls<TitleSettings>;
  xaxis: FormGroup<AxisFormGroup>;
  yaxis: FormGroup<AxisFormGroup>;
}

export interface PlotlyConfigFormGroup {
  toImageButtonOptions: FormGroupControls<
    Partial<{
      filename: string;
      format: 'png' | 'svg' | 'jpeg' | 'webp';
      height: number;
      scale: number;
      width: number;
    }>
  >;
}

/**
 * Form group for plot settings.
 */
export interface NshmpPlotSettingFormGroup {
  config: FormGroup<PlotlyConfigFormGroup>;
  layout: FormGroup<NshmpPlotLayoutFormGroup>;
}

/**
 * Plot for applicaitons.
 */
export interface NshmpPlot {
  /** Plot label */
  label: string;
  /** Plotly plot data */
  plotData: PlotlyPlot;
  /** Plot settings form state */
  settingsForm: FormGroup<NshmpPlotSettingFormGroup>;
}

/**
 * Plot settings.
 */
export interface NshmpPlotSettings {
  /** Plot config settings */
  config: Partial<PlotlyConfig>;
  /** Plot layout settings */
  layout: LayoutSettings;
}

/**
 * Plot title settings
 */
export interface TitleSettings {
  /** Title size */
  size: number;
  /** Title text */
  text: string;
}

results matching ""

    No results matching ""