@c8y/ngx-components 1023.65.1 → 1023.65.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1692,13 +1692,23 @@ class ChartRealtimeService {
1692
1692
  m.time,
1693
1693
  m[datapoint.fragment][datapoint.series].value
1694
1694
  ]);
1695
+ newValues.sort(([a], [b]) => new Date(a).valueOf() - new Date(b).valueOf());
1695
1696
  const datapointId = datapoint.__target?.id + datapoint.fragment + datapoint.series;
1696
1697
  const seriesMatchingDatapoint = allDataSeries.find(s => s['datapointId'] === datapointId);
1697
1698
  if (!seriesMatchingDatapoint) {
1698
1699
  return;
1699
1700
  }
1700
1701
  const seriesDataToUpdate = seriesMatchingDatapoint['data'];
1701
- seriesDataToUpdate.push(...newValues);
1702
+ let lastExistingTimestamp = seriesDataToUpdate.length
1703
+ ? new Date(seriesDataToUpdate[seriesDataToUpdate.length - 1][0]).valueOf()
1704
+ : -Infinity;
1705
+ for (const [timestamp, value] of newValues) {
1706
+ const ts = new Date(timestamp).valueOf();
1707
+ if (ts > lastExistingTimestamp) {
1708
+ seriesDataToUpdate.push([timestamp, value]);
1709
+ lastExistingTimestamp = ts;
1710
+ }
1711
+ }
1702
1712
  seriesMatchingDatapoint['data'] = this.removeValuesBeforeTimeRange(seriesMatchingDatapoint);
1703
1713
  this.checkForValuesAfterTimeRange(seriesMatchingDatapoint['data'], datapoint, datapointOutOfSyncCallback);
1704
1714
  });