@@ -25,7 +25,7 @@ import {
2525import { ThemeService } from './theme.service' ;
2626import { Subscription } from 'rxjs' ;
2727import { distinctUntilChanged } from 'rxjs/operators' ;
28- import { merge } from 'lodash-es ' ;
28+ import { merge } from 'es-toolkit ' ;
2929import {
3030 NG_CHARTS_CONFIGURATION ,
3131 NgChartsConfiguration ,
@@ -209,37 +209,33 @@ export class BaseChartDirective<
209209 TData ,
210210 TLabel
211211 > [ 'options' ] {
212- const baseOptions = {
213- onHover : ( event : ChartEvent , active : object [ ] ) => {
214- if ( ! this . chartHover . observed && ! this . chartHover . observers ?. length ) {
215- return ;
216- }
212+ return [
213+ {
214+ onHover : ( event : ChartEvent , active : object [ ] ) => {
215+ if ( ! this . chartHover . observed && ! this . chartHover . observers ?. length ) {
216+ return ;
217+ }
217218
218- this . zone . run ( ( ) => this . chartHover . emit ( { event, active } ) ) ;
219- } ,
220- onClick : ( event ?: ChartEvent , active ?: object [ ] ) => {
221- if ( ! this . chartClick . observed && ! this . chartClick . observers ?. length ) {
222- return ;
223- }
219+ this . zone . run ( ( ) => this . chartHover . emit ( { event, active } ) ) ;
220+ } ,
221+ onClick : ( event ?: ChartEvent , active ?: object [ ] ) => {
222+ if ( ! this . chartClick . observed && ! this . chartClick . observers ?. length ) {
223+ return ;
224+ }
224225
225- this . zone . run ( ( ) => this . chartClick . emit ( { event, active } ) ) ;
226+ this . zone . run ( ( ) => this . chartClick . emit ( { event, active } ) ) ;
227+ } ,
226228 } ,
227- } ;
228-
229- const legendOptions = {
230- plugins : {
231- legend : {
232- display : this . legend ,
229+ this . themeOverrides ?? { } ,
230+ this . options ?? { } ,
231+ {
232+ plugins : {
233+ legend : {
234+ display : this . legend ,
235+ } ,
233236 } ,
234237 } ,
235- } ;
236-
237- return merge (
238- baseOptions ,
239- this . themeOverrides || { } ,
240- this . options || { } ,
241- legendOptions ,
242- ) as ChartConfiguration < TType , TData , TLabel > [ 'options' ] ;
238+ ] . reduce ( merge , { } ) as ChartConfiguration < TType , TData , TLabel > [ 'options' ] ;
243239 }
244240
245241 private getChartConfiguration ( ) : ChartConfiguration < TType , TData , TLabel > {
0 commit comments