@@ -9,9 +9,6 @@ import React, {
9
9
import type { Ref , MouseEvent } from 'react' ;
10
10
import ChartJS from 'chart.js/auto' ;
11
11
import type { ChartData , ChartType , DefaultDataPoint } from 'chart.js' ;
12
- import merge from 'lodash/merge' ;
13
- import assign from 'lodash/assign' ;
14
- import find from 'lodash/find' ;
15
12
16
13
import { Props , ChartJSOrUndefined , TypedChartComponent } from './types' ;
17
14
@@ -49,7 +46,7 @@ function ChartComponent<
49
46
: {
50
47
datasets : [ ] ,
51
48
} ;
52
- } else return merge ( { } , data ) ;
49
+ } else return data ;
53
50
} , [ data , canvas . current ] ) ;
54
51
55
52
const [ chart , setChart ] = useState < TypedChartJS > ( ) ;
@@ -125,12 +122,11 @@ function ChartComponent<
125
122
const { datasets : currentDataSets = [ ] } = chart . config . data ;
126
123
127
124
// copy values
128
- assign ( chart . config . data , newChartData ) ;
125
+ Object . assign ( chart . config . data , newChartData ) ;
129
126
130
127
chart . config . data . datasets = newDataSets . map ( ( newDataSet : any ) => {
131
128
// given the new set, find it's current match
132
- const currentDataSet = find (
133
- currentDataSets ,
129
+ const currentDataSet = currentDataSets . find (
134
130
d => d . label === newDataSet . label && d . type === newDataSet . type
135
131
) ;
136
132
@@ -146,10 +142,13 @@ function ChartComponent<
146
142
}
147
143
148
144
// copy in values
149
- assign ( currentDataSet . data , newDataSet . data ) ;
145
+ Object . assign ( currentDataSet . data , newDataSet . data ) ;
150
146
151
147
// apply dataset changes, but keep copied data
152
- assign ( currentDataSet , { ...newDataSet , data : currentDataSet . data } ) ;
148
+ Object . assign ( currentDataSet , {
149
+ ...newDataSet ,
150
+ data : currentDataSet . data ,
151
+ } ) ;
153
152
return currentDataSet ;
154
153
} ) ;
155
154
0 commit comments