@eox/chart 2.0.0-alpha7b → 2.0.0-alpha8

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
@@ -4,11 +4,11 @@
4
4
  <meta charset="UTF-8" />
5
5
  <title>EOxElements Chart</title>
6
6
  <style>
7
- *{
7
+ * {
8
8
  font-family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
9
9
  font-size: 0.95em;
10
10
  }
11
- label{
11
+ label {
12
12
  margin-top: 2.5px;
13
13
  }
14
14
  html,
@@ -26,7 +26,7 @@
26
26
  visibility: hidden;
27
27
  }
28
28
  .loader {
29
- position: absolute;
29
+ position: absolute;
30
30
  top: 5px;
31
31
  right: 30px;
32
32
  width: 24px;
@@ -39,7 +39,7 @@
39
39
  animation: rotation 1s linear infinite;
40
40
  }
41
41
  .loader::after {
42
- content: '';
42
+ content: "";
43
43
  box-sizing: border-box;
44
44
  position: absolute;
45
45
  left: 0;
@@ -67,7 +67,7 @@
67
67
  flex-direction: row;
68
68
  }
69
69
  .parsingError {
70
- background-color : #ff6d6d;
70
+ background-color: #ff6d6d;
71
71
  }
72
72
  #chart {
73
73
  padding-top: 30px;
@@ -1,53 +1,108 @@
1
- var y = Object.defineProperty;
2
- var b = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var d = (s, t, e) => (b(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- const g = new MessageChannel(), o = g.port1;
5
- class f {
1
+ var f = Object.defineProperty;
2
+ var x = (s, t, e) => t in s ? f(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var h = (s, t, e) => (x(s, typeof t != "symbol" ? t + "" : t, e), e);
4
+ const b = "@eox/chart", w = "2.0.0-alpha8", v = {
5
+ "chart.js": "^4.2.1",
6
+ "chartjs-adapter-luxon": "^1.3.1",
7
+ "chartjs-chart-error-bars": "^4.1.2"
8
+ }, D = {
9
+ "@eox/eslint-config": "^1.0.0",
10
+ "@types/luxon": "^3.2.0",
11
+ "@typescript-eslint/eslint-plugin": "^5.50.0",
12
+ "@typescript-eslint/parser": "^5.50.0",
13
+ cypress: "^12.6.0",
14
+ "cypress-vite": "^1.3.0",
15
+ "eslint-plugin-cypress": "^2.12.1",
16
+ "eslint-plugin-typescript": "^0.14.0",
17
+ install: "^0.13.0",
18
+ luxon: "^3.3.0",
19
+ npm: "^9.6.3",
20
+ "p-retry": "^5.1.2",
21
+ "pre-commit": "^1.2.2",
22
+ "start-server-and-test": "^1.15.2",
23
+ typescript: "^4.9.3",
24
+ vite: "^4.0.0"
25
+ }, M = {
26
+ npm: ">=8.0.0",
27
+ node: ">=18.0.0"
28
+ }, j = [
29
+ "dist",
30
+ "scripts",
31
+ "src",
32
+ "typings"
33
+ ], S = "./dist/interface.mjs", C = {
34
+ start: "vite",
35
+ build: "tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",
36
+ watch: "node scripts/watch.mjs",
37
+ preview: "vite preview",
38
+ format: "prettier --write .",
39
+ lint: "eslint --ext .js,.ts .",
40
+ "lint:fix": "eslint --ext .js,.ts . --fix",
41
+ cypress: "start-server-and-test start 5173 'cypress open'",
42
+ test: "start-server-and-test start 5173 'cypress run'"
43
+ }, E = {
44
+ name: b,
45
+ version: w,
46
+ dependencies: v,
47
+ devDependencies: D,
48
+ engines: M,
49
+ files: j,
50
+ main: S,
51
+ scripts: C,
52
+ "pre-commit": [
53
+ "format",
54
+ "lint:fix"
55
+ ]
56
+ }, u = new MessageChannel(), n = u.port1;
57
+ class k {
6
58
  constructor(t) {
7
- d(this, "iframe");
59
+ h(this, "iframe");
8
60
  this.iframe = t;
9
61
  }
10
62
  setData(t) {
11
- o.postMessage({ type: "setData", body: { data: t } });
63
+ n.postMessage({ type: "setData", body: { data: t } });
12
64
  }
13
65
  setSignalsData(t) {
14
- o.postMessage({ type: "setSignalsData", body: { data: t } });
66
+ n.postMessage({ type: "setSignalsData", body: { data: t } });
15
67
  }
16
68
  setSignalsEndpoint(t) {
17
- o.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
69
+ n.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
18
70
  }
19
71
  setSignalsGeometry(t) {
20
- o.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
72
+ n.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
21
73
  }
22
74
  setOptions(t) {
23
- o.postMessage({ type: "setOptions", body: { options: t } });
75
+ n.postMessage({ type: "setOptions", body: { options: t } });
24
76
  }
25
77
  getFoo() {
26
78
  return new Promise((t) => {
27
79
  const e = Date.now();
28
- o.onmessage = (a) => {
29
- a.data.ts === e && t(a.data.body);
30
- }, o.postMessage({ ts: e, type: "getFoo", body: "hello world" });
80
+ n.onmessage = (o) => {
81
+ o.data.ts === e && t(o.data.body);
82
+ }, n.postMessage({ ts: e, type: "getFoo", body: "hello world" });
31
83
  });
32
84
  }
33
85
  }
34
- const D = (s) => s ? new Promise((t) => {
35
- var r, l, c, i;
86
+ const $ = (s) => s ? new Promise((t) => {
87
+ var a, c, p, l;
36
88
  const e = document.createElement("iframe");
37
- e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
89
+ if (e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
38
90
  "src",
39
- (l = (r = import.meta) == null ? void 0 : r.url) != null && l.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
40
- ), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (i = (c = import.meta) == null ? void 0 : c.url) != null && i.includes("localhost") || fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then((n) => n.text()).then((n) => {
41
- var m, p, h;
42
- const u = n.replace("./assets/", "https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");
43
- (m = e.contentDocument) == null || m.open(), (p = e.contentDocument) == null || p.write(u), (h = e.contentDocument) == null || h.close();
44
- });
45
- let a = !1;
91
+ (c = (a = import.meta) == null ? void 0 : a.url) != null && c.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
92
+ ), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), !((l = (p = import.meta) == null ? void 0 : p.url) != null && l.includes("localhost"))) {
93
+ const r = `https://www.unpkg.com/@eox/chart@${E.version}/dist`;
94
+ fetch(`${r}/index.html`).then((i) => i.text()).then((i) => {
95
+ var d, m, g;
96
+ const y = i.replace("./assets/", `${r}/assets/`);
97
+ (d = e.contentDocument) == null || d.open(), (m = e.contentDocument) == null || m.write(y), (g = e.contentDocument) == null || g.close();
98
+ });
99
+ }
100
+ let o = !1;
46
101
  e.onload = () => {
47
- var n;
48
- a || ((n = e.contentWindow) == null || n.postMessage("init", "*", [g.port2]), a = !0, t(new f(e)));
102
+ var r;
103
+ o || ((r = e.contentWindow) == null || r.postMessage("init", "*", [u.port2]), o = !0, t(new k(e)));
49
104
  };
50
105
  }) : (console.error("no div selected"), null);
51
106
  export {
52
- D as createChart
107
+ $ as createChart
53
108
  };
@@ -1 +1 @@
1
- (function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.Interface={}))})(this,function(s){"use strict";var g=Object.defineProperty;var b=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var f=(s,t,n)=>(b(s,typeof t!="symbol"?t+"":t,n),n);const t=new MessageChannel,n=t.port1;class m{constructor(e){f(this,"iframe");this.iframe=e}setData(e){n.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){n.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){n.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){n.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){n.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const o=Date.now();n.onmessage=i=>{i.data.ts===o&&e(i.data.body)},n.postMessage({ts:o,type:"getFoo",body:"hello world"})})}}const h=a=>a?new Promise(e=>{var c,d;const o=document.createElement("iframe");o.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",o.setAttribute("src",(c=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&&c.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),o.setAttribute("id","EOxChart"),a==null||a.appendChild(o),(d=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&&d.includes("localhost")||fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then(r=>r.text()).then(r=>{var l,u,p;const y=r.replace("./assets/","https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");(l=o.contentDocument)==null||l.open(),(u=o.contentDocument)==null||u.write(y),(p=o.contentDocument)==null||p.close()});let i=!1;o.onload=()=>{var r;i||((r=o.contentWindow)==null||r.postMessage("init","*",[t.port2]),i=!0,e(new m(o)))}}):(console.error("no div selected"),null);s.createChart=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,s){typeof exports=="object"&&typeof module<"u"?s(exports):typeof define=="function"&&define.amd?define(["exports"],s):(n=typeof globalThis<"u"?globalThis:n||self,s(n.Interface={}))})(this,function(n){"use strict";var v=Object.defineProperty;var S=(n,s,o)=>s in n?v(n,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):n[s]=o;var y=(n,s,o)=>(S(n,typeof s!="symbol"?s+"":s,o),o);const g={name:"@eox/chart",version:"2.0.0-alpha8",dependencies:{"chart.js":"^4.2.1","chartjs-adapter-luxon":"^1.3.1","chartjs-chart-error-bars":"^4.1.2"},devDependencies:{"@eox/eslint-config":"^1.0.0","@types/luxon":"^3.2.0","@typescript-eslint/eslint-plugin":"^5.50.0","@typescript-eslint/parser":"^5.50.0",cypress:"^12.6.0","cypress-vite":"^1.3.0","eslint-plugin-cypress":"^2.12.1","eslint-plugin-typescript":"^0.14.0",install:"^0.13.0",luxon:"^3.3.0",npm:"^9.6.3","p-retry":"^5.1.2","pre-commit":"^1.2.2","start-server-and-test":"^1.15.2",typescript:"^4.9.3",vite:"^4.0.0"},engines:{npm:">=8.0.0",node:">=18.0.0"},files:["dist","scripts","src","typings"],main:"./dist/interface.mjs",scripts:{start:"vite",build:"tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",watch:"node scripts/watch.mjs",preview:"vite preview",format:"prettier --write .",lint:"eslint --ext .js,.ts .","lint:fix":"eslint --ext .js,.ts . --fix",cypress:"start-server-and-test start 5173 'cypress open'",test:"start-server-and-test start 5173 'cypress run'"},"pre-commit":["format","lint:fix"]},d=new MessageChannel,i=d.port1;class b{constructor(e){y(this,"iframe");this.iframe=e}setData(e){i.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){i.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){i.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){i.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){i.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const t=Date.now();i.onmessage=c=>{c.data.ts===t&&e(c.data.body)},i.postMessage({ts:t,type:"getFoo",body:"hello world"})})}}const w=r=>r?new Promise(e=>{var l,u;const t=document.createElement("iframe");if(t.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",t.setAttribute("src",(l=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&&l.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),t.setAttribute("id","EOxChart"),r==null||r.appendChild(t),!((u=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&&u.includes("localhost"))){const a=`https://www.unpkg.com/@eox/chart@${g.version}/dist`;fetch(`${a}/index.html`).then(p=>p.text()).then(p=>{var f,m,h;const x=p.replace("./assets/",`${a}/assets/`);(f=t.contentDocument)==null||f.open(),(m=t.contentDocument)==null||m.write(x),(h=t.contentDocument)==null||h.close()})}let c=!1;t.onload=()=>{var a;c||((a=t.contentWindow)==null||a.postMessage("init","*",[d.port2]),c=!0,e(new b(t)))}}):(console.error("no div selected"),null);n.createChart=w,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eox/chart",
3
- "version": "2.0.0-alpha7b",
3
+ "version": "2.0.0-alpha8",
4
4
  "dependencies": {
5
5
  "chart.js": "^4.2.1",
6
6
  "chartjs-adapter-luxon": "^1.3.1",
@@ -28,6 +28,13 @@
28
28
  "npm": ">=8.0.0",
29
29
  "node": ">=18.0.0"
30
30
  },
31
+ "files": [
32
+ "dist",
33
+ "scripts",
34
+ "src",
35
+ "typings"
36
+ ],
37
+ "main": "./dist/interface.mjs",
31
38
  "scripts": {
32
39
  "start": "vite",
33
40
  "build": "tsc && vite build --config vite.config.interface.ts && vite build --config vite.config.map.ts",
package/src/interface.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import pkg from "../package.json";
2
+
1
3
  const channel = new MessageChannel();
2
4
  const port1 = channel.port1;
3
5
 
@@ -62,16 +64,17 @@ const createChart = (div: HTMLElement | null) => {
62
64
  iframe.setAttribute("id", "EOxChart");
63
65
  div?.appendChild(iframe);
64
66
  if (!import.meta?.url?.includes("localhost")) {
65
- fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html")
66
- .then((response) => {
67
- return response.text();
68
- })
69
- .then((text) => {
70
- const html = text.replace('./assets/', 'https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/');
71
- iframe.contentDocument?.open();
72
- iframe.contentDocument?.write(html);
73
- iframe.contentDocument?.close();
74
- })
67
+ const hostUrl = `https://www.unpkg.com/@eox/chart@${pkg.version}/dist`;
68
+ fetch(`${hostUrl}/index.html`)
69
+ .then((response) => {
70
+ return response.text();
71
+ })
72
+ .then((text) => {
73
+ const html = text.replace("./assets/", `${hostUrl}/assets/`);
74
+ iframe.contentDocument?.open();
75
+ iframe.contentDocument?.write(html);
76
+ iframe.contentDocument?.close();
77
+ });
75
78
  }
76
79
  let iframeLoaded = false;
77
80
  iframe.onload = () => {
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- dist
2
- public
package/.eslintrc.js DELETED
@@ -1,9 +0,0 @@
1
- module.exports = {
2
- env: {
3
- "cypress/globals": true,
4
- },
5
- extends: ["@eox", "plugin:@typescript-eslint/recommended"],
6
- parser: "@typescript-eslint/parser",
7
- plugins: ["cypress", "@typescript-eslint"],
8
- root: true,
9
- };
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- dist
2
- public
@@ -1,34 +0,0 @@
1
- import { createChart } from "../../src/interface";
2
-
3
- describe("general", () => {
4
- beforeEach(() => {
5
- cy.visit("../../public/test.html");
6
- });
7
- it("loads the chart", () => {
8
- cy.document().then((doc) => {
9
- const init = async () => {
10
- const chart = await createChart(doc.querySelector("#chart"));
11
- const data = {
12
- datasets: [
13
- {
14
- type: "bar",
15
- label: "Bar Dataset",
16
- data: [1, 2, 3, 4],
17
- },
18
- {
19
- type: "line",
20
- label: "Line Dataset",
21
- data: [6, 6, 6, 6],
22
- },
23
- ],
24
- labels: ["January", "February", "March", "April"],
25
- };
26
- chart?.setData(data);
27
- const test = await chart?.getFoo();
28
- console.log(test);
29
- };
30
- init();
31
- });
32
- cy.get('[data-cy="chart"] > iframe').should("exist");
33
- });
34
- });
@@ -1,417 +0,0 @@
1
- {
2
- "evi": [
3
- {
4
- "basicStats": {
5
- "max": 0.3550589084625244,
6
- "mean": 0.22059480493460512,
7
- "min": 0.12014900892972946,
8
- "stDev": 0.05062963384869639
9
- },
10
- "date": "2022-03-15"
11
- },
12
- {
13
- "basicStats": {
14
- "max": 0.4187798798084259,
15
- "mean": 0.24745809068146724,
16
- "min": 0.12343892455101013,
17
- "stDev": 0.062029942348332034
18
- },
19
- "date": "2022-03-25"
20
- },
21
- {
22
- "basicStats": {
23
- "max": 0.48604267835617065,
24
- "mean": 0.3150590416963138,
25
- "min": 0.15982015430927277,
26
- "stDev": 0.07354433835077807
27
- },
28
- "date": "2022-04-04"
29
- },
30
- {
31
- "basicStats": {
32
- "max": 0.598889172077179,
33
- "mean": 0.38407523801360854,
34
- "min": 0.19289220869541168,
35
- "stDev": 0.08956019341871195
36
- },
37
- "date": "2022-04-14"
38
- },
39
- {
40
- "basicStats": {
41
- "max": 0.6682642102241516,
42
- "mean": 0.39702817576240396,
43
- "min": 0.19576843082904816,
44
- "stDev": 0.09375953665992383
45
- },
46
- "date": "2022-04-24"
47
- },
48
- {
49
- "basicStats": {
50
- "max": 0.6155948638916016,
51
- "mean": 0.4098868370971465,
52
- "min": 0.22542662918567657,
53
- "stDev": 0.06999486010331954
54
- },
55
- "date": "2022-05-04"
56
- },
57
- {
58
- "basicStats": {
59
- "max": 0.5713241100311279,
60
- "mean": 0.39737077568219487,
61
- "min": 0.2379172444343567,
62
- "stDev": 0.05901234972947041
63
- },
64
- "date": "2022-05-14"
65
- },
66
- {
67
- "basicStats": {
68
- "max": 0.5792034864425659,
69
- "mean": 0.35908391015600294,
70
- "min": 0.2872035503387451,
71
- "stDev": 0.03605644542093036
72
- },
73
- "date": "2022-05-24"
74
- },
75
- {
76
- "basicStats": {
77
- "max": 0.5466872453689575,
78
- "mean": 0.32375791539711063,
79
- "min": 0.25171026587486267,
80
- "stDev": 0.036041907916295454
81
- },
82
- "date": "2022-06-03"
83
- }
84
- ],
85
- "nddi": [
86
- {
87
- "basicStats": {
88
- "max": 18.90780258178711,
89
- "mean": 1.3850002521340155,
90
- "min": 0.40726199746131897,
91
- "stDev": 2.6123725693138953
92
- },
93
- "date": "2022-03-15"
94
- },
95
- {
96
- "basicStats": {
97
- "max": 10.200146675109863,
98
- "mean": 0.9182252266121623,
99
- "min": 0.2709024250507355,
100
- "stDev": 1.3994401896631248
101
- },
102
- "date": "2022-03-25"
103
- },
104
- {
105
- "basicStats": {
106
- "max": 4.332663059234619,
107
- "mean": 0.5509570467408071,
108
- "min": 0.13095761835575104,
109
- "stDev": 0.6298421233922363
110
- },
111
- "date": "2022-04-04"
112
- },
113
- {
114
- "basicStats": {
115
- "max": 1.9867826700210571,
116
- "mean": 0.33416227769519363,
117
- "min": 0.10483401268720627,
118
- "stDev": 0.25612107549976254
119
- },
120
- "date": "2022-04-14"
121
- },
122
- {
123
- "basicStats": {
124
- "max": 2.3523149490356445,
125
- "mean": 0.3511467087700553,
126
- "min": 0.11805409938097,
127
- "stDev": 0.305879751198955
128
- },
129
- "date": "2022-04-24"
130
- },
131
- {
132
- "basicStats": {
133
- "max": 1.3965336084365845,
134
- "mean": 0.33400160022681136,
135
- "min": 0.09463103860616684,
136
- "stDev": 0.21766109465658331
137
- },
138
- "date": "2022-05-04"
139
- },
140
- {
141
- "basicStats": {
142
- "max": 1.2820371389389038,
143
- "mean": 0.3267598677598587,
144
- "min": 0.10988888889551163,
145
- "stDev": 0.20093533591817903
146
- },
147
- "date": "2022-05-14"
148
- },
149
- {
150
- "basicStats": {
151
- "max": 0.7473884224891663,
152
- "mean": 0.2954656333254665,
153
- "min": 0.05666257068514824,
154
- "stDev": 0.11693275787472403
155
- },
156
- "date": "2022-05-24"
157
- },
158
- {
159
- "basicStats": {
160
- "max": 0.5366320013999939,
161
- "mean": 0.2969953213320961,
162
- "min": 0.023719042539596558,
163
- "stDev": 0.10104303610714575
164
- },
165
- "date": "2022-06-03"
166
- }
167
- ],
168
- "ndvi": [
169
- {
170
- "basicStats": {
171
- "max": 0.6014397740364075,
172
- "mean": 0.41612433722993136,
173
- "min": 0.2957623302936554,
174
- "stDev": 0.0727004516062551
175
- },
176
- "date": "2022-03-15"
177
- },
178
- {
179
- "basicStats": {
180
- "max": 0.6564452052116394,
181
- "mean": 0.45588806082428046,
182
- "min": 0.2966938614845276,
183
- "stDev": 0.08344269797103256
184
- },
185
- "date": "2022-03-25"
186
- },
187
- {
188
- "basicStats": {
189
- "max": 0.7504225373268127,
190
- "mean": 0.5504008913693121,
191
- "min": 0.36974036693573,
192
- "stDev": 0.08940500540419291
193
- },
194
- "date": "2022-04-04"
195
- },
196
- {
197
- "basicStats": {
198
- "max": 0.8306431770324707,
199
- "mean": 0.6314340978642626,
200
- "min": 0.4089595377445221,
201
- "stDev": 0.09460136548487377
202
- },
203
- "date": "2022-04-14"
204
- },
205
- {
206
- "basicStats": {
207
- "max": 0.8457924127578735,
208
- "mean": 0.632236462448655,
209
- "min": 0.40922072529792786,
210
- "stDev": 0.09419082557226978
211
- },
212
- "date": "2022-04-24"
213
- },
214
- {
215
- "basicStats": {
216
- "max": 0.7968989014625549,
217
- "mean": 0.6313434431669995,
218
- "min": 0.42545709013938904,
219
- "stDev": 0.07541881706154915
220
- },
221
- "date": "2022-05-04"
222
- },
223
- {
224
- "basicStats": {
225
- "max": 0.7625213861465454,
226
- "mean": 0.6106250831621499,
227
- "min": 0.43760743737220764,
228
- "stDev": 0.06402189222438505
229
- },
230
- "date": "2022-05-14"
231
- },
232
- {
233
- "basicStats": {
234
- "max": 0.785315990447998,
235
- "mean": 0.563478274933021,
236
- "min": 0.4446161687374115,
237
- "stDev": 0.04710273399829552
238
- },
239
- "date": "2022-05-24"
240
- },
241
- {
242
- "basicStats": {
243
- "max": 0.7467761039733887,
244
- "mean": 0.5033061891265151,
245
- "min": 0.3754289746284485,
246
- "stDev": 0.054429291442119304
247
- },
248
- "date": "2022-06-03"
249
- }
250
- ],
251
- "ndwi": [
252
- {
253
- "basicStats": {
254
- "max": 0.24447646737098694,
255
- "mean": 0.05385102006389305,
256
- "min": -0.2715572714805603,
257
- "stDev": 0.1168021100517783
258
- },
259
- "date": "2022-03-15"
260
- },
261
- {
262
- "basicStats": {
263
- "max": 0.3765927255153656,
264
- "mean": 0.11764056809086258,
265
- "min": -0.25011956691741943,
266
- "stDev": 0.13192276855001103
267
- },
268
- "date": "2022-03-25"
269
- },
270
- {
271
- "basicStats": {
272
- "max": 0.5369506478309631,
273
- "mean": 0.23535562727847764,
274
- "min": -0.23376944661140442,
275
- "stDev": 0.16413171444187102
276
- },
277
- "date": "2022-04-04"
278
- },
279
- {
280
- "basicStats": {
281
- "max": 0.6277323961257935,
282
- "mean": 0.3532735487179871,
283
- "min": -0.16249069571495056,
284
- "stDev": 0.16010121907504435
285
- },
286
- "date": "2022-04-14"
287
- },
288
- {
289
- "basicStats": {
290
- "max": 0.645155131816864,
291
- "mean": 0.351150626651568,
292
- "min": -0.17455558478832245,
293
- "stDev": 0.16545804551039875
294
- },
295
- "date": "2022-04-24"
296
- },
297
- {
298
- "basicStats": {
299
- "max": 0.6346530914306641,
300
- "mean": 0.34658381395074894,
301
- "min": -0.07039669901132584,
302
- "stDev": 0.14425695710507297
303
- },
304
- "date": "2022-05-04"
305
- },
306
- {
307
- "basicStats": {
308
- "max": 0.607755720615387,
309
- "mean": 0.33509889218710587,
310
- "min": -0.05635707825422287,
311
- "stDev": 0.12977527934165456
312
- },
313
- "date": "2022-05-14"
314
- },
315
- {
316
- "basicStats": {
317
- "max": 0.6228088736534119,
318
- "mean": 0.3137814263790035,
319
- "min": 0.07944389432668686,
320
- "stDev": 0.08356455075568822
321
- },
322
- "date": "2022-05-24"
323
- },
324
- {
325
- "basicStats": {
326
- "max": 0.6241552233695984,
327
- "mean": 0.2761122933283006,
328
- "min": 0.16474543511867523,
329
- "stDev": 0.06336799660603812
330
- },
331
- "date": "2022-06-03"
332
- }
333
- ],
334
- "savi": [
335
- {
336
- "basicStats": {
337
- "max": 0.3519461750984192,
338
- "mean": 0.22617715640549646,
339
- "min": 0.12689147889614105,
340
- "stDev": 0.04863405880644912
341
- },
342
- "date": "2022-03-15"
343
- },
344
- {
345
- "basicStats": {
346
- "max": 0.40694671869277954,
347
- "mean": 0.25231215516135524,
348
- "min": 0.1301409751176834,
349
- "stDev": 0.05846165534856253
350
- },
351
- "date": "2022-03-25"
352
- },
353
- {
354
- "basicStats": {
355
- "max": 0.4673684239387512,
356
- "mean": 0.3158992708741373,
357
- "min": 0.17074868083000183,
358
- "stDev": 0.06709622103071823
359
- },
360
- "date": "2022-04-04"
361
- },
362
- {
363
- "basicStats": {
364
- "max": 0.5567160844802856,
365
- "mean": 0.38005226624888183,
366
- "min": 0.20187601447105408,
367
- "stDev": 0.07953739023924075
368
- },
369
- "date": "2022-04-14"
370
- },
371
- {
372
- "basicStats": {
373
- "max": 0.6135095953941345,
374
- "mean": 0.39059067392503727,
375
- "min": 0.20191919803619385,
376
- "stDev": 0.0823907296413076
377
- },
378
- "date": "2022-04-24"
379
- },
380
- {
381
- "basicStats": {
382
- "max": 0.5714061856269836,
383
- "mean": 0.4011334329381139,
384
- "min": 0.23138704895973206,
385
- "stDev": 0.06171800387554556
386
- },
387
- "date": "2022-05-04"
388
- },
389
- {
390
- "basicStats": {
391
- "max": 0.5369637608528137,
392
- "mean": 0.38993105218270996,
393
- "min": 0.24143381416797638,
394
- "stDev": 0.05271926633766714
395
- },
396
- "date": "2022-05-14"
397
- },
398
- {
399
- "basicStats": {
400
- "max": 0.5449269413948059,
401
- "mean": 0.3545232835597487,
402
- "min": 0.2914884090423584,
403
- "stDev": 0.03233048622917166
404
- },
405
- "date": "2022-05-24"
406
- },
407
- {
408
- "basicStats": {
409
- "max": 0.5156502723693848,
410
- "mean": 0.3215323156575666,
411
- "min": 0.2626720666885376,
412
- "stDev": 0.031769682098438216
413
- },
414
- "date": "2022-06-03"
415
- }
416
- ]
417
- }
@@ -1,26 +0,0 @@
1
- import { createChart } from "../../src/interface";
2
- import signalsData from "./sh.json";
3
-
4
- describe("shDisplay", () => {
5
- beforeEach(() => {
6
- cy.visit("../../public/test.html");
7
- });
8
- it("loads data retrieved from signals-api endpoint", () => {
9
- cy.document().then((doc) => {
10
- const init = async () => {
11
- const chart = await createChart(doc.querySelector("#chart"));
12
-
13
- const options = {
14
- parsing: {
15
- xAxisKey: "date",
16
- yAxisKey: "basicStats.mean",
17
- },
18
- };
19
- chart?.setOptions(options);
20
- chart?.setSignalsData(signalsData);
21
- };
22
- init();
23
- });
24
- cy.get('[data-cy="chart"] > iframe').should("exist");
25
- });
26
- });
@@ -1,145 +0,0 @@
1
- import { createChart } from "../../src/interface";
2
-
3
- describe("shDisplay", () => {
4
- beforeEach(() => {
5
- cy.visit("../../public/test.html");
6
- });
7
- it("configures signals endpoint for chart to retrieve data", () => {
8
- cy.document().then((doc) => {
9
- const init = async () => {
10
- const chart = await createChart(doc.querySelector("#chart"));
11
-
12
- const options = {
13
- endpoint:
14
- "https://prototype-gftb1dhets8kbrfhr3zdka.ddc.hub.eox.at/eo-signals-api/eo-signals-for-geometry",
15
- source: "sentinelhub",
16
- features: [
17
- [
18
- "s1_rvi",
19
- "s2_ndvi",
20
- "s2_ndwi",
21
- "s2_mndwi",
22
- "s2_nddi",
23
- "s2_ndmi",
24
- "s2_nbsi",
25
- "s2_evi",
26
- "s2_savi",
27
- "spei",
28
- "pni",
29
- "spi",
30
- ],
31
- ["s2_vci"],
32
- [
33
- "modis_ndvi",
34
- "modis_ndwi",
35
- "modis_savi",
36
- "modis_evi",
37
- "modis_nddi",
38
- ],
39
- ["s3_ndvi", "s3_otci", "s2_lai", "s2_fapar"],
40
- ],
41
- colors: [
42
- "#ff0029",
43
- "#377eb8",
44
- "#66a61e",
45
- "#984ea3",
46
- "#00d2d5",
47
- "#ff7f00",
48
- "#af8d00",
49
- "#7f80cd",
50
- "#b3e900",
51
- "#c42e60",
52
- "#a65628",
53
- "#f781bf",
54
- "#8dd3c7",
55
- "#bebada",
56
- "#fb8072",
57
- "#80b1d3",
58
- "#fdb462",
59
- "#fccde5",
60
- "#bc80bd",
61
- "#ffed6f",
62
- "#c4eaff",
63
- "#cf8c00",
64
- ],
65
- // retries: 5,
66
- // normalize: true,
67
- active: ["modis_ndvi"],
68
- // timeAggregation: { week: 1 },
69
- timeInterval: {
70
- months: 3,
71
- },
72
- startTime: "2023-01-01",
73
- endTime: "2023-03-30",
74
- geometry: {
75
- type: "Polygon",
76
- coordinates: [
77
- [
78
- [20.13079927, 47.10302768],
79
- [20.13084045, 47.1028265],
80
- [20.1358676, 47.10146968],
81
- [20.13740927, 47.10014585],
82
- [20.13947607, 47.09893601],
83
- [20.14091366, 47.09999145],
84
- [20.1449318, 47.10150223],
85
- [20.14791146, 47.10230676],
86
- [20.15021132, 47.10395088],
87
- [20.15405271, 47.10427089],
88
- [20.15892741, 47.10398568],
89
- [20.15852441, 47.10137122],
90
- [20.15762095, 47.09983277],
91
- [20.15739972, 47.0975736],
92
- [20.15803736, 47.09471102],
93
- [20.16078555, 47.09278008],
94
- [20.16202649, 47.09216975],
95
- [20.15674646, 47.08971359],
96
- [20.14955762, 47.08650222],
97
- [20.13871746, 47.08287273],
98
- [20.13206638, 47.08157835],
99
- [20.12726444, 47.08162372],
100
- [20.12231283, 47.0824622],
101
- [20.11401767, 47.08174784],
102
- [20.11216468, 47.08018127],
103
- [20.10948393, 47.07862235],
104
- [20.10265513, 47.07664915],
105
- [20.09653792, 47.07715786],
106
- [20.08739187, 47.07520495],
107
- [20.08127912, 47.07681145],
108
- [20.07655974, 47.08095206],
109
- [20.06658042, 47.07842296],
110
- [20.05716056, 47.0777923],
111
- [20.05220315, 47.08017979],
112
- [20.04630443, 47.08419526],
113
- [20.04133418, 47.08864202],
114
- [20.03220524, 47.08935493],
115
- [20.03172385, 47.09164789],
116
- [20.03114258, 47.09606486],
117
- [20.03149467, 47.09719311],
118
- [20.03319485, 47.09955417],
119
- [20.03803622, 47.10154872],
120
- [20.04451973, 47.10273689],
121
- [20.04782854, 47.10248179],
122
- [20.05408279, 47.1002776],
123
- [20.05902427, 47.09876342],
124
- [20.06282968, 47.0985035],
125
- [20.06912826, 47.09867377],
126
- [20.07212495, 47.0994389],
127
- [20.08114396, 47.10320425],
128
- [20.08584159, 47.10621624],
129
- [20.08800841, 47.10687536],
130
- [20.09697203, 47.10769864],
131
- [20.10840521, 47.10770649],
132
- [20.12110234, 47.10464688],
133
- [20.12769884, 47.1031142],
134
- [20.13079927, 47.10302768],
135
- ],
136
- ],
137
- },
138
- };
139
- chart?.setSignalsEndpoint(options);
140
- };
141
- init();
142
- });
143
- cy.get('[data-cy="chart"] > iframe').should("exist");
144
- });
145
- });
package/cypress.config.ts DELETED
@@ -1,11 +0,0 @@
1
- import { defineConfig } from "cypress";
2
- import vitePreprocessor from "cypress-vite";
3
-
4
- export default defineConfig({
5
- e2e: {
6
- setupNodeEvents(on) {
7
- on("file:preprocessor", vitePreprocessor());
8
- },
9
- supportFile: false,
10
- },
11
- });
package/index.html DELETED
@@ -1,82 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>EOxElements Chart</title>
6
- <style>
7
- *{
8
- font-family: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif";
9
- font-size: 0.95em;
10
- }
11
- label{
12
- margin-top: 2.5px;
13
- }
14
- html,
15
- body {
16
- margin: 0;
17
- padding: 0;
18
- }
19
- html,
20
- body,
21
- .chart {
22
- width: 100%;
23
- height: 100%;
24
- }
25
- .hidden {
26
- visibility: hidden;
27
- }
28
- .loader {
29
- position: absolute;
30
- top: 5px;
31
- right: 30px;
32
- width: 24px;
33
- height: 24px;
34
- border-radius: 50%;
35
- display: inline-block;
36
- border-top: 4px solid #000;
37
- border-right: 4px solid transparent;
38
- box-sizing: border-box;
39
- animation: rotation 1s linear infinite;
40
- }
41
- .loader::after {
42
- content: '';
43
- box-sizing: border-box;
44
- position: absolute;
45
- left: 0;
46
- top: 0;
47
- width: 24px;
48
- height: 24px;
49
- border-radius: 50%;
50
- border-left: 4px solid #004170;
51
- border-bottom: 4px solid transparent;
52
- animation: rotation 0.5s linear infinite reverse;
53
- }
54
- @keyframes rotation {
55
- 0% {
56
- transform: rotate(0deg);
57
- }
58
- 100% {
59
- transform: rotate(360deg);
60
- }
61
- }
62
- #controls {
63
- position: absolute;
64
- width: 100%;
65
- display: flex;
66
- gap: 5px;
67
- flex-direction: row;
68
- }
69
- .parsingError {
70
- background-color : #ff6d6d;
71
- }
72
- #chart {
73
- padding-top: 30px;
74
- }
75
- </style>
76
- </head>
77
- <body>
78
- <div id="controls" class="controls" data-cy="controls"></div>
79
- <canvas id="chart" class="chart" data-cy="chart"></canvas>
80
- <script type="module" src="./src/main.ts"></script>
81
- </body>
82
- </html>
@@ -1,53 +0,0 @@
1
- var y = Object.defineProperty;
2
- var b = (s, t, e) => t in s ? y(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
- var d = (s, t, e) => (b(s, typeof t != "symbol" ? t + "" : t, e), e);
4
- const g = new MessageChannel(), o = g.port1;
5
- class f {
6
- constructor(t) {
7
- d(this, "iframe");
8
- this.iframe = t;
9
- }
10
- setData(t) {
11
- o.postMessage({ type: "setData", body: { data: t } });
12
- }
13
- setSignalsData(t) {
14
- o.postMessage({ type: "setSignalsData", body: { data: t } });
15
- }
16
- setSignalsEndpoint(t) {
17
- o.postMessage({ type: "setSignalsEndpoint", body: { options: t } });
18
- }
19
- setSignalsGeometry(t) {
20
- o.postMessage({ type: "setSignalsGeometry", body: { geometry: t } });
21
- }
22
- setOptions(t) {
23
- o.postMessage({ type: "setOptions", body: { options: t } });
24
- }
25
- getFoo() {
26
- return new Promise((t) => {
27
- const e = Date.now();
28
- o.onmessage = (a) => {
29
- a.data.ts === e && t(a.data.body);
30
- }, o.postMessage({ ts: e, type: "getFoo", body: "hello world" });
31
- });
32
- }
33
- }
34
- const D = (s) => s ? new Promise((t) => {
35
- var r, l, c, i;
36
- const e = document.createElement("iframe");
37
- e.style.cssText = "width: 100%; height: 100%; display: block; margin: 0; border: none;", e.setAttribute(
38
- "src",
39
- (l = (r = import.meta) == null ? void 0 : r.url) != null && l.includes("localhost") ? "http://localhost:5173/index.html" : "about:blank"
40
- ), e.setAttribute("id", "EOxChart"), s == null || s.appendChild(e), (i = (c = import.meta) == null ? void 0 : c.url) != null && i.includes("localhost") || fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then((n) => n.text()).then((n) => {
41
- var m, p, h;
42
- const u = n.replace("./assets/", "https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");
43
- (m = e.contentDocument) == null || m.open(), (p = e.contentDocument) == null || p.write(u), (h = e.contentDocument) == null || h.close();
44
- });
45
- let a = !1;
46
- e.onload = () => {
47
- var n;
48
- a || ((n = e.contentWindow) == null || n.postMessage("init", "*", [g.port2]), a = !0, t(new f(e)));
49
- };
50
- }) : (console.error("no div selected"), null);
51
- export {
52
- D as createChart
53
- };
@@ -1 +0,0 @@
1
- (function(s,t){typeof exports=="object"&&typeof module<"u"?t(exports):typeof define=="function"&&define.amd?define(["exports"],t):(s=typeof globalThis<"u"?globalThis:s||self,t(s.Interface={}))})(this,function(s){"use strict";var g=Object.defineProperty;var b=(s,t,n)=>t in s?g(s,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):s[t]=n;var f=(s,t,n)=>(b(s,typeof t!="symbol"?t+"":t,n),n);const t=new MessageChannel,n=t.port1;class m{constructor(e){f(this,"iframe");this.iframe=e}setData(e){n.postMessage({type:"setData",body:{data:e}})}setSignalsData(e){n.postMessage({type:"setSignalsData",body:{data:e}})}setSignalsEndpoint(e){n.postMessage({type:"setSignalsEndpoint",body:{options:e}})}setSignalsGeometry(e){n.postMessage({type:"setSignalsGeometry",body:{geometry:e}})}setOptions(e){n.postMessage({type:"setOptions",body:{options:e}})}getFoo(){return new Promise(e=>{const o=Date.now();n.onmessage=i=>{i.data.ts===o&&e(i.data.body)},n.postMessage({ts:o,type:"getFoo",body:"hello world"})})}}const h=a=>a?new Promise(e=>{var c,d;const o=document.createElement("iframe");o.style.cssText="width: 100%; height: 100%; display: block; margin: 0; border: none;",o.setAttribute("src",(c=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&&c.includes("localhost")?"http://localhost:5173/index.html":"about:blank"),o.setAttribute("id","EOxChart"),a==null||a.appendChild(o),(d=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&&d.includes("localhost")||fetch("https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/index.html").then(r=>r.text()).then(r=>{var l,u,p;const y=r.replace("./assets/","https://raw.githack.com/EOX-A/elements/chartelement/elements/chart/dist/assets/");(l=o.contentDocument)==null||l.open(),(u=o.contentDocument)==null||u.write(y),(p=o.contentDocument)==null||p.close()});let i=!1;o.onload=()=>{var r;i||((r=o.contentWindow)==null||r.postMessage("init","*",[t.port2]),i=!0,e(new m(o)))}}):(console.error("no div selected"),null);s.createChart=h,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
package/public/test.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Simple Chart</title>
6
- <style>
7
- html,
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- }
12
- html,
13
- body,
14
- .chart {
15
- width: 100%;
16
- height: 100%;
17
- }
18
- </style>
19
- </head>
20
- <body>
21
- <div id="chart" class="chart" data-cy="chart"></div>
22
- </body>
23
- </html>
package/test.html DELETED
@@ -1,23 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Simple Chart</title>
6
- <style>
7
- html,
8
- body {
9
- margin: 0;
10
- padding: 0;
11
- }
12
- html,
13
- body,
14
- .chart {
15
- width: 100%;
16
- height: 100%;
17
- }
18
- </style>
19
- </head>
20
- <body>
21
- <canvas id="chart" class="chart" data-cy="chart"></canvas>
22
- </body>
23
- </html>
package/tsconfig.json DELETED
@@ -1,21 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "strictNullChecks": false,
4
- "target": "ESNext",
5
- "useDefineForClassFields": true,
6
- "module": "ESNext",
7
- "lib": ["ESNext", "DOM"],
8
- "moduleResolution": "Node",
9
- "strict": true,
10
- "resolveJsonModule": true,
11
- "esModuleInterop": true,
12
- "noEmit": true,
13
- "noUnusedLocals": true,
14
- "noUnusedParameters": true,
15
- "noImplicitReturns": true,
16
- "skipLibCheck": true,
17
- "typeRoots": ["./typings"],
18
- "types": ["cypress"]
19
- },
20
- "include": ["**/*.ts"]
21
- }
@@ -1,19 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import { resolve } from "path";
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- build: {
7
- emptyOutDir: false,
8
- lib: {
9
- entry: resolve(__dirname, "src/interface.ts"),
10
- name: "Interface",
11
- fileName: "interface",
12
- },
13
- rollupOptions: {
14
- output: {
15
- dir: "public",
16
- },
17
- },
18
- },
19
- });
@@ -1,15 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import { resolve } from "path";
3
-
4
- // https://vitejs.dev/config/
5
- export default defineConfig({
6
- base: "./",
7
- build: {
8
- // emptyOutDir: false,
9
- rollupOptions: {
10
- input: {
11
- main: resolve(__dirname, "index.html"),
12
- },
13
- },
14
- },
15
- });