import { DialogPosition } from '@angular/material/dialog'; import { ChartDataset, ChartType, Plugin } from 'chart.js'; import { CustomChartOptions } from '../../charts'; import { CHARTS_TYPES } from '../constants'; import { BaseReportConfig } from './base'; import { ChartOptionsByType } from './common'; import { ReportDataSource } from './report-data-source'; type chartTypes = Omit; export type AllowedChartType = chartTypes[keyof chartTypes]; export interface ChartTypeConfig { enabled: boolean; allowedTypes?: AllowedChartType[]; } /** * Configuration for dialog display in graph reports */ export type GraphDialogConfig = { active: boolean; panelClass?: string | string[]; width?: string; height?: string; minWidth?: number | string; minHeight?: number | string; maxWidth?: number | string; maxHeight?: number | string; position?: DialogPosition; }; export type CallbackDefinition = { path: string; callback: string; }; /** * Definition of chart options with plugins as strings (used in configuration) */ export type GraphChartOptionsDefinition = { type: TType; options?: CustomChartOptions; datasets?: Omit, 'data'>[]; overrides?: ChartOptionsByType; plugins?: string[]; callbacks?: Array; colors?: string[]; direction?: 'horizontal' | 'vertical'; }; /** * Chart options with plugins as Plugin objects (used in implementation) */ export type GraphChartOptions = Omit, 'plugins'> & { plugins?: Plugin[]; }; /** * Complete definition of a graph chart (used in configuration) */ export type GraphChartDefinition = BaseReportConfig & { mode: 'graph'; datasource: ReportDataSource[]; chart: GraphChartOptionsDefinition; prefix?: string; print?: boolean; typeConfig?: ChartTypeConfig; dialog?: GraphDialogConfig; }; /** * Complete graph chart with processed plugins (used in implementation) */ export type GraphChart = Omit, 'chart'> & { chart: GraphChartOptions; }; export {};