@@ -35,9 +35,6 @@ export class SparkLines {
35
35
uniqueItems : Map < string , number >
36
36
onlySelected : boolean
37
37
38
- private readonly currentSmoothedValues : number [ ] [ ]
39
- private readonly baseSmoothedValues : number [ ] [ ]
40
-
41
38
constructor ( opt : CompareSparkLinesOptions ) {
42
39
this . currentSeries = opt . series
43
40
this . baseSeries = opt . baseSeries ?? [ ]
@@ -59,17 +56,16 @@ export class SparkLines {
59
56
const margin = Math . floor ( opt . width / 64 )
60
57
this . rowWidth = Math . min ( 450 , opt . width - Math . max ( 3 * margin , 60 ) )
61
58
62
- this . currentSmoothedValues = [ ]
63
- this . baseSmoothedValues = [ ]
64
59
let [ smoothWindow , _ ] = getSmoothWindow ( this . currentSeries , this . baseSeries , opt . smoothValue )
65
- for ( let i = 0 ; i < this . currentSeries . length ; i ++ ) {
66
- let smoothedSeries = smoothSeries ( this . currentSeries [ i ] . series , smoothWindow [ 0 ] [ i ] )
67
- this . currentSmoothedValues . push ( smoothedSeries . map ( d => d . smoothed ) )
68
- }
69
- for ( let i = 0 ; i < this . baseSeries . length ; i ++ ) {
70
- let smoothedSeries = smoothSeries ( this . baseSeries [ i ] . series , smoothWindow [ 0 ] [ 1 ] )
71
- this . baseSmoothedValues . push ( smoothedSeries . map ( d => d . smoothed ) )
72
- }
60
+
61
+ this . currentSeries = this . currentSeries . map ( ( s , i ) => {
62
+ s . series = smoothSeries ( s . series , smoothWindow [ 0 ] [ i ] )
63
+ return s
64
+ } )
65
+ this . baseSeries = this . baseSeries . map ( ( s , i ) => {
66
+ s . series = smoothSeries ( s . series , smoothWindow [ 1 ] [ i ] )
67
+ return s
68
+ } )
73
69
74
70
this . stepExtent = getExtent ( this . currentSeries . concat ( this . baseSeries ) . map ( s => s . series ) , d => d . step )
75
71
@@ -104,7 +100,6 @@ export class SparkLines {
104
100
onClick : onClick ,
105
101
color : this . chartColors . getColor ( this . uniqueItems . get ( s . name ) ) ,
106
102
isMouseMoveOpt : this . isMouseMoveOpt ,
107
- smoothedValues : this . currentSmoothedValues [ i ] ,
108
103
isComparison : this . baseSeries . length > 0
109
104
} )
110
105
this . sparkLines . push ( sparkLine )
@@ -130,7 +125,6 @@ export class SparkLines {
130
125
isMouseMoveOpt : this . isMouseMoveOpt ,
131
126
isBase : true ,
132
127
isComparison : this . baseSeries . length > 0 ,
133
- smoothedValues : this . baseSmoothedValues [ i ]
134
128
} )
135
129
this . sparkLines . push ( sparkLine )
136
130
} )
0 commit comments