@c8y/ngx-components 1023.14.103 → 1023.14.104

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.
@@ -432,6 +432,7 @@ class EchartsOptionsService {
432
432
  this.severityLabelPipe = severityLabelPipe;
433
433
  this.translate = translate;
434
434
  this.router = router;
435
+ this.AGGREGATED_SERIES_TYPE = 'aggr';
435
436
  this.TOOLTIP_WIDTH = 300;
436
437
  }
437
438
  getChartOptions(datapointsWithValues, timeRange, showSplitLines, events, alarms, displayOptions, selectedTimeRange, aggregatedDatapoint, sliderZoomUsed = false) {
@@ -654,11 +655,11 @@ class EchartsOptionsService {
654
655
  const renderType = aggregatedDatapoint?.renderType || 'min';
655
656
  const idx = 0;
656
657
  if (renderType === 'area') {
657
- series.push(this.getSingleSeries(aggregatedDatapoint, 'min', idx, true, displayOptions, 'aggr'));
658
- series.push(this.getSingleSeries(aggregatedDatapoint, 'max', idx, true, displayOptions, 'aggr'));
658
+ series.push(this.getSingleSeries(aggregatedDatapoint, 'min', idx, true, displayOptions, this.AGGREGATED_SERIES_TYPE));
659
+ series.push(this.getSingleSeries(aggregatedDatapoint, 'max', idx, true, displayOptions, this.AGGREGATED_SERIES_TYPE));
659
660
  }
660
661
  else {
661
- series.push(this.getSingleSeries(aggregatedDatapoint, renderType, idx, false, displayOptions, 'aggr'));
662
+ series.push(this.getSingleSeries(aggregatedDatapoint, renderType, idx, false, displayOptions, this.AGGREGATED_SERIES_TYPE));
662
663
  }
663
664
  series.forEach((s) => {
664
665
  s.datapointId = 'aggregated';
@@ -1393,6 +1394,13 @@ class EchartsOptionsService {
1393
1394
  }
1394
1395
  getSingleSeries(dp, renderType, idx, isMinMaxChart = false, displayOptions, seriesType = '') {
1395
1396
  const datapointId = dp.__target?.id + dp.fragment + dp.series;
1397
+ const isAggr = seriesType === this.AGGREGATED_SERIES_TYPE;
1398
+ const data = isAggr && Object.keys(dp.values).length <= 1
1399
+ ? []
1400
+ : Object.entries(dp.values).map(([dateString, values]) => [
1401
+ dateString,
1402
+ values[0][renderType]
1403
+ ]);
1396
1404
  return {
1397
1405
  datapointId,
1398
1406
  datapointUnit: dp.unit || '',
@@ -1401,11 +1409,8 @@ class EchartsOptionsService {
1401
1409
  ? `${datapointId}/${renderType}${seriesType}`
1402
1410
  : `${datapointId}${seriesType}`,
1403
1411
  name: `${dp.label} (${dp.__target?.['name']})`,
1404
- // datapointLabel used to proper display of tooltip
1405
1412
  datapointLabel: dp.label || '',
1406
- data: Object.entries(dp.values).map(([dateString, values]) => {
1407
- return [dateString, values[0][renderType]];
1408
- }),
1413
+ data,
1409
1414
  ...(displayOptions.forceMergeDatapoints ? {} : { yAxisIndex: idx }),
1410
1415
  ...this.chartTypesService.getSeriesOptions(dp, isMinMaxChart, renderType)
1411
1416
  };