import { Injectable } from '@angular/core' ; import { ChartType as ChartJSType } from 'chart.js' ; import { AnnotationType , AnnotationTypeRegistry } from 'chartjs-plugin-annotation' ; import { deepCopy } from '../../../helpers/deep-copy' ; import { ChartType , ChartTypeConfig } from '../chart.types' ; import { CHART_ANNOTATIONS_CONFIG } from './annotations.config' ; import { CHART_INTERACTION_FUNCTIONS_EXTENSIONS } from './interaction-functions-extensions.config' ; import { CHART_TYPES_CONFIG } from './type.config' ; @ Injectable ( ) export class ChartConfigService { public getTypeConfig ( chartType ) { return deepCopy ( CHART_TYPES_CONFIG [ chartType ] ) ; } public getAnnotationDefaults ( type ) { return CHART_ANNOTATIONS_CONFIG [ type ] ; } public getInteractionFunctionsExtensions ( ) { return CHART_INTERACTION_FUNCTIONS_EXTENSIONS ; } public chartTypeToChartJSType ( chartType ) { return CHART_TYPES_CONFIG [ chartType ] [ 'type' ] as ChartJSType ; } }