import { BarController , BarElement , CategoryScale , Chart , Filler , Legend , LinearScale , LineController , LineElement , PointElement , TimeScale , Tooltip , } from 'chart.js' ; import annotationPlugin from 'chartjs-plugin-annotation' ; import ChartDataLabels from 'chartjs-plugin-datalabels' ; import { mergeDeepAll } from '../../../helpers/merge-deep' ; import MarkerPlugin from '../chart-js/chartjs-plugin-marker/chartjs-plugin-marker' ; import { CHART_GLOBAL_DEFAULTS } from '../configs/global-defaults.config' ; const CHART_SCALES = [ CategoryScale , LinearScale ] ; const CHART_ELEMENTS = [ BarElement , LineElement , PointElement ] ; const CHART_CONTROLLERS = [ BarController , LineController ] ; const CHART_PLUGINS = [ annotationPlugin , Filler , ChartDataLabels , Tooltip , MarkerPlugin ] ; Chart . register ( Legend , ... CHART_SCALES , ... CHART_ELEMENTS , ... CHART_CONTROLLERS , ... CHART_PLUGINS ) ; const mergedDefaults = mergeDeepAll ( Chart . defaults , CHART_GLOBAL_DEFAULTS ) ; Object . entries ( CHART_GLOBAL_DEFAULTS ) . forEach ( ( [ key ] ) => { Chart . defaults [ key ] = mergedDefaults [ key ] ; } ) ; export { Chart } ;