@eox/chart 2.0.0-alpha1 → 2.0.0-alpha2

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.
package/dist/index.html CHANGED
@@ -51,9 +51,17 @@
51
51
  100% {
52
52
  transform: rotate(360deg);
53
53
  }
54
- }
54
+ }
55
+ #controls {
56
+ position: absolute;
57
+ width: 100%;
58
+ height: 30px;
59
+ }
60
+ #chart {
61
+ padding-top: 30px;
62
+ }
55
63
  </style>
56
- <script type="module" crossorigin src="./assets/main-800e32b1.js"></script>
64
+ <script type="module" crossorigin src="./assets/main-7d9c1cfa.js"></script>
57
65
  </head>
58
66
  <body>
59
67
  <div id="controls" class="controls" data-cy="controls"></div>
@@ -1,8 +1,8 @@
1
- var c = Object.defineProperty;
2
- var d = (s, t, e) => t in s ? c(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => (d(s, typeof t != "symbol" ? t + "" : t, e), e);
1
+ var d = Object.defineProperty;
2
+ var c = (s, t, e) => t in s ? d(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var l = (s, t, e) => (c(s, typeof t != "symbol" ? t + "" : t, e), e);
4
4
  const p = new MessageChannel(), o = p.port1;
5
- class h {
5
+ class g {
6
6
  constructor(t) {
7
7
  l(this, "iframe");
8
8
  this.iframe = t;
@@ -16,6 +16,9 @@ class h {
16
16
  setSignalsEndpoint(t) {
17
17
  o.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
18
18
  }
19
+ setSignalsGeometry(t) {
20
+ o.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
21
+ }
19
22
  setOptions(t) {
20
23
  o.postMessage({ type: "setOptions", body: { options: t } });
21
24
  }
@@ -38,7 +41,7 @@ const m = (s) => s ? new Promise((t) => {
38
41
  let a = !1;
39
42
  e.onload = () => {
40
43
  var i;
41
- a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new h(e)));
44
+ a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new g(e)));
42
45
  };
43
46
  }) : (console.error("no div selected"), null);
44
47
  export {
@@ -1 +1 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,e,o)=>e in n?u(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o;var c=(n,e,o)=>(f(n,typeof e!="symbol"?e+"":e,o),o);const e=new MessageChannel,o=e.port1;class l{constructor(t){c(this,"iframe");this.iframe=t}setData(t){o.postMessage({type:"setData",body:{data:t}})}setSignalsData(t){o.postMessage({type:"setSignalsData",body:{data:t}})}setSignalsEndpoint(t){o.postMessage({type:"setSignalsEndpoint",body:{options:t}})}setOptions(t){o.postMessage({type:"setOptions",body:{options:t}})}getFoo(){return new Promise(t=>{const s=Date.now();o.onmessage=a=>{a.data.ts===s&&t(a.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=r=>r?new Promise(t=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),r==null||r.appendChild(s);let a=!1;s.onload=()=>{var d;a||((d=s.contentWindow)==null||d.postMessage("init","*",[e.port2]),a=!0,t(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,t,o)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var c=(n,t,o)=>(f(n,typeof t!="symbol"?t+"":t,o),o);const t=new MessageChannel,o=t.port1;class l{constructor(e){c(this,"iframe");this.iframe=e}setData(e){o.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){o.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){o.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){o.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){o.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const s=Date.now();o.onmessage=r=>{r.data.ts===s&&e(r.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=a=>a?new Promise(e=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),a==null||a.appendChild(s);let r=!1;s.onload=()=>{var d;r||((d=s.contentWindow)==null||d.postMessage("init","*",[t.port2]),r=!0,e(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/index.html CHANGED
@@ -51,7 +51,15 @@
51
51
  100% {
52
52
  transform: rotate(360deg);
53
53
  }
54
- }
54
+ }
55
+ #controls {
56
+ position: absolute;
57
+ width: 100%;
58
+ height: 30px;
59
+ }
60
+ #chart {
61
+ padding-top: 30px;
62
+ }
55
63
  </style>
56
64
  </head>
57
65
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "2.0.0-alpha1",
3
+ "version": "2.0.0-alpha2",
4
4
  "dependencies": {
5
5
  "chart.js": "^4.2.1",
6
6
  "chartjs-adapter-luxon": "^1.3.1",
@@ -1,8 +1,8 @@
1
- var c = Object.defineProperty;
2
- var d = (s, t, e) => t in s ? c(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var l = (s, t, e) => (d(s, typeof t != "symbol" ? t + "" : t, e), e);
1
+ var d = Object.defineProperty;
2
+ var c = (s, t, e) => t in s ? d(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var l = (s, t, e) => (c(s, typeof t != "symbol" ? t + "" : t, e), e);
4
4
  const p = new MessageChannel(), o = p.port1;
5
- class h {
5
+ class g {
6
6
  constructor(t) {
7
7
  l(this, "iframe");
8
8
  this.iframe = t;
@@ -16,6 +16,9 @@ class h {
16
16
  setSignalsEndpoint(t) {
17
17
  o.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
18
18
  }
19
+ setSignalsGeometry(t) {
20
+ o.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
21
+ }
19
22
  setOptions(t) {
20
23
  o.postMessage({ type: "setOptions", body: { options: t } });
21
24
  }
@@ -38,7 +41,7 @@ const m = (s) => s ? new Promise((t) => {
38
41
  let a = !1;
39
42
  e.onload = () => {
40
43
  var i;
41
- a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new h(e)));
44
+ a || ((i = e.contentWindow) == null || i.postMessage("init", "*", [p.port2]), a = !0, t(new g(e)));
42
45
  };
43
46
  }) : (console.error("no div selected"), null);
44
47
  export {
@@ -1 +1 @@
1
- (function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports):typeof define=="function"&&define.amd?define(["exports"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,e,o)=>e in n?u(n,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[e]=o;var c=(n,e,o)=>(f(n,typeof e!="symbol"?e+"":e,o),o);const e=new MessageChannel,o=e.port1;class l{constructor(t){c(this,"iframe");this.iframe=t}setData(t){o.postMessage({type:"setData",body:{data:t}})}setSignalsData(t){o.postMessage({type:"setSignalsData",body:{data:t}})}setSignalsEndpoint(t){o.postMessage({type:"setSignalsEndpoint",body:{options:t}})}setOptions(t){o.postMessage({type:"setOptions",body:{options:t}})}getFoo(){return new Promise(t=>{const s=Date.now();o.onmessage=a=>{a.data.ts===s&&t(a.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=r=>r?new Promise(t=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),r==null||r.appendChild(s);let a=!1;s.onload=()=>{var d;a||((d=s.contentWindow)==null||d.postMessage("init","*",[e.port2]),a=!0,t(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(n=typeof globalThis<"u"?globalThis:n||self,t(n.Interface={}))})(this,function(n){"use strict";var u=Object.defineProperty;var f=(n,t,o)=>t in n?u(n,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[t]=o;var c=(n,t,o)=>(f(n,typeof t!="symbol"?t+"":t,o),o);const t=new MessageChannel,o=t.port1;class l{constructor(e){c(this,"iframe");this.iframe=e}setData(e){o.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){o.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){o.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){o.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){o.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const s=Date.now();o.onmessage=r=>{r.data.ts===s&&e(r.data.body)},o.postMessage({ts:s,type:"getFoo",body:"hello world"})})}}const p=a=>a?new Promise(e=>{var i;const s=document.createElement("iframe");s.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",s.setAttribute("src",(i=typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:document.currentScript&&document.currentScript.src||new URL("interface.umd.js",document.baseURI).href)!=null&&i.includes("localhost")?"http://localhost:5173/index.html":"https://www.unpkg.com/@eox/chart/dist/index.html"),s.setAttribute("id","EOxChart"),a==null||a.appendChild(s);let r=!1;s.onload=()=>{var d;r||((d=s.contentWindow)==null||d.postMessage("init","*",[t.port2]),r=!0,e(new l(s)))}}):(console.error("no div selected"),null);n.createChart=p,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
@@ -16,10 +16,15 @@ class ChartControls {
16
16
  this.element = element;
17
17
  this.sdm = sdm;
18
18
  this.options = options;
19
- this.generateSelectionOptions();
19
+ this.generateTimeSelectionOptions();
20
+ this.generateTimeAggregationOptions();
21
+ const spinner = document.createElement("span");
22
+ spinner.id = "loadingIndicator";
23
+ spinner.className = "loader hidden";
24
+ this.element.appendChild(spinner);
20
25
  }
21
26
 
22
- private generateSelectionOptions() {
27
+ private generateTimeSelectionOptions() {
23
28
  const options = [
24
29
  { text: "3 months back", value: "months3" },
25
30
  { text: "6 months back", value: "months6" },
@@ -55,7 +60,44 @@ class ChartControls {
55
60
  break;
56
61
  }
57
62
  });
63
+ }
64
+
65
+ private generateTimeAggregationOptions() {
66
+ const options = [
67
+ { text: "no aggregation", value: "none" },
68
+ { text: "1 week", value: "week-1" },
69
+ { text: "2 weeks", value: "week-2" },
70
+ { text: "1 month", value: "month-1" },
71
+ { text: "3 months", value: "month-3" },
72
+ { text: "6 months", value: "month-6" },
73
+ ];
74
+ const selectEl = document.createElement("select");
75
+ options.forEach((entry) => {
76
+ const option = document.createElement("option");
77
+ option.text = entry.text;
78
+ option.value = entry.value;
79
+ selectEl.appendChild(option);
80
+ });
81
+ this.element.appendChild(selectEl);
82
+ selectEl.addEventListener("change", (evt) => {
83
+ const [type, val] = (evt.target as HTMLSelectElement).value.split("-");
84
+ switch (type) {
85
+ case "none":
86
+ this.sdm.setTimeAggregation(null);
87
+ break;
88
+ case "week":
89
+ this.sdm.setTimeAggregation({ week: Number(val) });
90
+ break;
91
+ case "month":
92
+ this.sdm.setTimeAggregation({ month: Number(val) });
93
+ break;
94
+ case "year":
95
+ this.sdm.setTimeAggregation({ year: Number(val) });
96
+ break;
97
+ }
98
+ });
58
99
  const spinner = document.createElement("span");
100
+ spinner.id = "loadingIndicator";
59
101
  spinner.className = "loader hidden";
60
102
  this.element.appendChild(spinner);
61
103
  }
package/src/interface.ts CHANGED
@@ -24,6 +24,9 @@ class EOxChart {
24
24
  }) {
25
25
  port1.postMessage({ type: "setSignalsEndpoint", body: { options } });
26
26
  }
27
+ setSignalsGeometry(geometry: object) {
28
+ port1.postMessage({ type: "setSignalsGeometry", body: { geometry } });
29
+ }
27
30
  setOptions(options: object) {
28
31
  port1.postMessage({ type: "setOptions", body: { options } });
29
32
  }
package/src/main.ts CHANGED
@@ -13,6 +13,8 @@ const eoxchart = new Chart(
13
13
  }
14
14
  );
15
15
 
16
+ let sdmInstance: SignalsDataManager | null = null;
17
+
16
18
  let application: MessagePort;
17
19
 
18
20
  window.addEventListener("message", (event) => {
@@ -39,6 +41,9 @@ const onMessage = (event: MessageEvent) => {
39
41
  case "setSignalsEndpoint":
40
42
  setSignalsEndpoint(event.data.body.options);
41
43
  break;
44
+ case "setSignalsGeometry":
45
+ setSignalsGeometry(event.data.body.options);
46
+ break;
42
47
  case "setSignalsData":
43
48
  eoxchart.data = {
44
49
  datasets: Object.entries(event.data.body.data).map(
@@ -71,7 +76,13 @@ const setSignalsEndpoint = (options: {
71
76
  startTime?: string;
72
77
  endTime?: string;
73
78
  }) => {
74
- const sdm = new SignalsDataManager(eoxchart, options);
75
- new ChartControls(document.getElementById("controls"), sdm);
76
- sdm.setActiveFields(options.active);
79
+ sdmInstance = new SignalsDataManager(eoxchart, options);
80
+ new ChartControls(document.getElementById("controls"), sdmInstance);
81
+ sdmInstance.setActiveFields(options.active);
82
+ };
83
+
84
+ const setSignalsGeometry = (geometry: object) => {
85
+ if (sdmInstance) {
86
+ sdmInstance.setGeometry(geometry);
87
+ }
77
88
  };
@@ -47,12 +47,14 @@ export interface SDMOptions {
47
47
  timeInterval: object;
48
48
  startTime?: string;
49
49
  endTime?: string;
50
+ timeAggregation?: object;
50
51
  }
51
52
 
52
53
  class SignalsDataManager {
53
54
  chart: Chart;
54
55
  startTime: DateTime;
55
56
  endTime: DateTime;
57
+ timeAggregation: object;
56
58
  options: SDMOptions;
57
59
  chartOptions: ChartOptions;
58
60
  dataStorage: DSDict;
@@ -69,6 +71,9 @@ class SignalsDataManager {
69
71
  this.startTime = DateTime.fromISO(options.startTime).setZone("UTC");
70
72
  this.endTime = DateTime.fromISO(options.endTime).setZone("UTC");
71
73
  }
74
+ if (this.options.timeAggregation) {
75
+ this.timeAggregation = this.options.timeAggregation;
76
+ }
72
77
  this.dataStorage = {};
73
78
  // Initialize data storage
74
79
  this.options.features.forEach((_, idx) => (this.dataStorage[idx] = {}));
@@ -91,6 +96,13 @@ class SignalsDataManager {
91
96
  },
92
97
  plugins: {
93
98
  legend: {
99
+ labels: {
100
+ /*
101
+ usePointStyle: true,
102
+ pointStyle: "line",
103
+ */
104
+ sort: (a, b) => a.text.localeCompare(b.text),
105
+ },
94
106
  position: "right",
95
107
  onClick: (_, legendItem) => {
96
108
  if (!legendItem.hidden) {
@@ -106,6 +118,19 @@ class SignalsDataManager {
106
118
  },
107
119
  };
108
120
  }
121
+ private checkLoadingStatus() {
122
+ const spinner = document.getElementById("loadingIndicator");
123
+ let loading = false;
124
+ // TODO: Showing when error state happened
125
+ Object.keys(this.dataStorage).forEach((_, groupIdx) => {
126
+ Object.keys(this.dataStorage[groupIdx]).forEach((timeKey) => {
127
+ if (this.dataStorage[groupIdx][timeKey].status === "fetching") {
128
+ loading = true;
129
+ }
130
+ });
131
+ });
132
+ spinner.className = loading ? "loader" : "loader hidden";
133
+ }
109
134
 
110
135
  private fetchSignals(groupIndex: number, start?: DateTime, end?: DateTime) {
111
136
  const features = this.options.features[groupIndex]
@@ -141,13 +166,15 @@ class SignalsDataManager {
141
166
  `Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} retries left.`
142
167
  );
143
168
  },
144
- retries: 5,
169
+ retries: 1,
145
170
  }).then(function (res) {
146
171
  return res.json();
147
172
  });
173
+ this.checkLoadingStatus();
148
174
  }
149
175
 
150
176
  private updateChart() {
177
+ this.checkLoadingStatus();
151
178
  this.chart.options = this.chartOptions;
152
179
  const datasets: ChartDataset[] = [];
153
180
  this.options.features.flat().forEach((key) => {
@@ -176,23 +203,68 @@ class SignalsDataManager {
176
203
  data.push({ date: "missing" });
177
204
  }
178
205
  });
206
+
207
+ let actualDataAdded = false;
208
+ let signalData = <any>data.map((datapoint) => {
209
+ let ds = {};
210
+ if (datapoint && datapoint.date !== "missing") {
211
+ ds = {
212
+ x: DateTime.fromISO(datapoint.date).setZone("UTC"),
213
+ y: datapoint.basicStats.mean,
214
+ yMin: [datapoint.basicStats.min],
215
+ yMax: [datapoint.basicStats.max],
216
+ };
217
+ actualDataAdded = true;
218
+ }
219
+ return ds;
220
+ });
221
+ if (actualDataAdded && this.timeAggregation) {
222
+ console.log("applying aggregation");
223
+ console.log(signalData);
224
+ const aggrData = [];
225
+ let currDataIdx = 0;
226
+ let currDate = DateTime.fromObject({
227
+ year: this.startTime.year,
228
+ month: this.startTime.month,
229
+ day: this.startTime.day,
230
+ });
231
+ while (currDate < this.endTime) {
232
+ let dataSum = 0;
233
+ while (
234
+ currDataIdx < signalData.length &&
235
+ signalData[currDataIdx].x < currDate
236
+ ) {
237
+ currDataIdx++;
238
+ }
239
+ const x1 = currDataIdx;
240
+ while (
241
+ currDataIdx < signalData.length &&
242
+ signalData[currDataIdx].x < currDate.plus(this.timeAggregation)
243
+ ) {
244
+ dataSum += signalData[currDataIdx].y;
245
+ currDataIdx++;
246
+ }
247
+ const x2 = currDataIdx;
248
+ const count = x2 - x1;
249
+ // If datapoints are within the interval we push the aggregation to the aggregated data
250
+ if (count > 0) {
251
+ // TODO: can we save a time interval here?
252
+ aggrData.push({
253
+ x: currDate,
254
+ y: dataSum / count,
255
+ });
256
+ }
257
+ currDate = currDate.plus(this.timeAggregation);
258
+ }
259
+ signalData = aggrData;
260
+ }
261
+
179
262
  datasets.push({
180
263
  // type: "lineWithErrorBars",
181
264
  type: "line",
182
265
  label: key,
183
266
  // casting to any because an array of object should also be possible
184
- data: <any>data.map((datapoint) => {
185
- let ds = {};
186
- if (datapoint && datapoint.date !== "missing") {
187
- ds = {
188
- x: DateTime.fromISO(datapoint.date).setZone("UTC"),
189
- y: datapoint.basicStats.mean,
190
- yMin: [datapoint.basicStats.min],
191
- yMax: [datapoint.basicStats.max],
192
- };
193
- }
194
- return ds;
195
- }),
267
+ data: signalData,
196
268
  hidden: !this.activeFields.includes(key),
197
269
  });
198
270
  }
@@ -245,11 +317,16 @@ class SignalsDataManager {
245
317
  })
246
318
  .plus({ month: 1 })
247
319
  .minus({ second: 1 })
248
- ).then((data) => {
249
- this.dataStorage[index][timeslot].data = data;
250
- this.dataStorage[index][timeslot].status = "finished";
251
- this.updateChart();
252
- });
320
+ )
321
+ .then((data) => {
322
+ this.dataStorage[index][timeslot].data = data;
323
+ this.dataStorage[index][timeslot].status = "finished";
324
+ this.updateChart();
325
+ })
326
+ .catch(() => {
327
+ this.dataStorage[index][timeslot].status = "failed";
328
+ this.updateChart();
329
+ });
253
330
  this.dataStorage[index][timeslot] = {
254
331
  request,
255
332
  status: "fetching",
@@ -260,6 +337,14 @@ class SignalsDataManager {
260
337
  }
261
338
  }
262
339
 
340
+ setGeometry(geometry: object) {
341
+ // Clear all currently saved data
342
+ this.dataStorage = {};
343
+ this.options.geometry = geometry;
344
+ this.retrieveMissingData();
345
+ this.updateChart();
346
+ }
347
+
263
348
  setActiveFields(activeFields: string[]) {
264
349
  this.activeFields = activeFields;
265
350
  this.retrieveMissingData();
@@ -274,6 +359,18 @@ class SignalsDataManager {
274
359
  this.retrieveMissingData();
275
360
  this.updateChart();
276
361
  }
362
+
363
+ setTimeAggregation(
364
+ aggregation: {
365
+ day?: number;
366
+ week?: number;
367
+ month?: number;
368
+ year?: number;
369
+ } | null
370
+ ) {
371
+ this.timeAggregation = aggregation;
372
+ this.updateChart();
373
+ }
277
374
  /*
278
375
  setAggregation(aggregation: string) {}
279
376
  */