Showing
1 changed file
with
9 additions
and
4 deletions
... | ... | @@ -433,7 +433,7 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic |
433 | 433 | } else { |
434 | 434 | prevSeries = [0, 0]; |
435 | 435 | } |
436 | - for (var time = startTime; time <= endTime; time += frequency) { | |
436 | + for (var time = startTime; time <= endTime && (timer || history); time += frequency) { | |
437 | 437 | var series = []; |
438 | 438 | series.push(time); |
439 | 439 | var value = dataKey.func(time, prevSeries[1]); |
... | ... | @@ -485,7 +485,6 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic |
485 | 485 | |
486 | 486 | if (timer) { |
487 | 487 | $timeout.cancel(timer); |
488 | - timer = null; | |
489 | 488 | } |
490 | 489 | |
491 | 490 | var key; |
... | ... | @@ -504,7 +503,7 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic |
504 | 503 | tickElapsed = tickElapsed - deltaElapsed; |
505 | 504 | for (key in dataKeys) { |
506 | 505 | var dataKeyList = dataKeys[key]; |
507 | - for (var index = 0; index < dataKeyList.length; index ++) { | |
506 | + for (var index = 0; index < dataKeyList.length && (timer || history); index ++) { | |
508 | 507 | var dataKey = dataKeyList[index]; |
509 | 508 | if (!startTime) { |
510 | 509 | if (realtime) { |
... | ... | @@ -514,6 +513,10 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic |
514 | 513 | } else { |
515 | 514 | startTime = datasourceSubscription.subscriptionTimewindow.startTs; |
516 | 515 | endTime = startTime + datasourceSubscription.subscriptionTimewindow.realtimeWindowMs + frequency; |
516 | + if (datasourceSubscription.subscriptionTimewindow.aggregation.type == types.aggregation.none.value) { | |
517 | + var time = endTime - frequency * datasourceSubscription.subscriptionTimewindow.aggregation.limit; | |
518 | + startTime = Math.max(time, startTime); | |
519 | + } | |
517 | 520 | } |
518 | 521 | } else { |
519 | 522 | startTime = datasourceSubscription.subscriptionTimewindow.fixedWindow.startTimeMs; |
... | ... | @@ -524,7 +527,9 @@ function DatasourceSubscription(datasourceSubscription, telemetryWebsocketServic |
524 | 527 | generatedData.data[dataKey.name+'_'+dataKey.index] = data; |
525 | 528 | } |
526 | 529 | } |
527 | - dataAggregator.onData(generatedData, true, history, apply); | |
530 | + if (dataAggregator) { | |
531 | + dataAggregator.onData(generatedData, true, history, apply); | |
532 | + } | |
528 | 533 | } else if (datasourceSubscription.type === types.widgetType.latest.value) { |
529 | 534 | for (key in dataKeys) { |
530 | 535 | generateLatest(dataKeys[key], apply); | ... | ... |