File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,15 @@ export default class TimeSeries {
115
115
currentValue = this . datapoints [ i ] [ 0 ] ;
116
116
currentTime = this . datapoints [ i ] [ 1 ] ;
117
117
118
+ // Due to missing values we could have different timeStep all along the series
119
+ // so we have to find the minimum one (could occur with aggregators such as ZimSum)
120
+ if ( i > 0 ) {
121
+ var previousTime = this . datapoints [ i - 1 ] [ 1 ] ;
122
+ if ( ! this . stats . timeStep || currentTime - previousTime < this . stats . timeStep ) {
123
+ this . stats . timeStep = currentTime - previousTime ;
124
+ }
125
+ }
126
+
118
127
if ( currentValue === null ) {
119
128
if ( ignoreNulls ) { continue ; }
120
129
if ( nullAsZero ) {
@@ -145,10 +154,6 @@ export default class TimeSeries {
145
154
result . push ( [ currentTime , currentValue ] ) ;
146
155
}
147
156
148
- if ( this . datapoints . length >= 2 ) {
149
- this . stats . timeStep = this . datapoints [ 1 ] [ 1 ] - this . datapoints [ 0 ] [ 1 ] ;
150
- }
151
-
152
157
if ( this . stats . max === - Number . MAX_VALUE ) { this . stats . max = null ; }
153
158
if ( this . stats . min === Number . MAX_VALUE ) { this . stats . min = null ; }
154
159
You can’t perform that action at this time.
0 commit comments