@c8y/ngx-components 1023.17.8 → 1023.17.13

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.
@@ -139,7 +139,8 @@ class YAxisService {
139
139
  label: {
140
140
  show: false
141
141
  }
142
- }
142
+ },
143
+ ...(datapointsWithValues[0] ? {} : { min: 0, max: 100 })
143
144
  };
144
145
  }
145
146
  const matchingDpSet = new Set();
@@ -231,6 +232,7 @@ class YAxisService {
231
232
  show: false
232
233
  }
233
234
  },
235
+ ...(Object.keys(dp.values || {}).length > 0 ? {} : { min: 0, max: 100 }),
234
236
  ...(dp.min && { min: dp.min }),
235
237
  ...(dp.max && { max: dp.max })
236
238
  };
@@ -511,8 +513,8 @@ class EchartsOptionsService {
511
513
  show: false
512
514
  },
513
515
  xAxis: {
514
- min: aggregatedDatapoint
515
- ? Object.keys(aggregatedDatapoint.values)
516
+ min: Object.keys(aggregatedDatapoint.values || {}).length > 0
517
+ ? Object.keys(aggregatedDatapoint.values || {})
516
518
  .map(date => new Date(date).valueOf())
517
519
  .sort((a, b) => a - b)[0]
518
520
  : new Date(timeRange.dateFrom).valueOf() - intervalInMs,
@@ -2094,7 +2096,13 @@ class ChartsComponent {
2094
2096
  return options?.series?.[0]?.markArea?.data?.length > 0;
2095
2097
  }
2096
2098
  saveAsImage() {
2097
- this.echartsInstance.setOption({ legend: { show: true } });
2099
+ const dataZoom = this.echartsInstance.getOption().dataZoom;
2100
+ const grid = this.echartsInstance.getOption().grid;
2101
+ this.echartsInstance.setOption({
2102
+ grid: { bottom: 8 },
2103
+ dataZoom: [{}, { show: false }]
2104
+ });
2105
+ this.echartsInstance.resize();
2098
2106
  const url = this.echartsInstance.getDataURL({
2099
2107
  pixelRatio: 2,
2100
2108
  backgroundColor: '#fff',
@@ -2106,7 +2114,8 @@ class ChartsComponent {
2106
2114
  document.body.appendChild(link);
2107
2115
  link.click();
2108
2116
  document.body.removeChild(link);
2109
- this.echartsInstance.setOption({ legend: { show: false } });
2117
+ this.echartsInstance.setOption({ dataZoom, grid });
2118
+ this.echartsInstance.resize(); // force resize to original state
2110
2119
  }
2111
2120
  loadMoreData() {
2112
2121
  const currentRange = this.widgetTimeContextDateRangeService.initialTimeRange();