@eox/chart 1.1.0 → 1.2.1
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/eox-chart.js +38865 -39347
- package/dist/eox-chart.umd.cjs +43 -33
- package/dist/material-symbols-outlined.woff2 +0 -0
- package/dist/material-symbols-rounded.woff2 +0 -0
- package/dist/material-symbols-sharp.woff2 +0 -0
- package/dist/material-symbols-subset.woff2 +0 -0
- package/package.json +9 -9
- package/src/main.js +43 -7
- package/src/methods/render/render-chart.js +2 -0
- package/types/main.d.ts +20 -7
- package/types/main.d.ts.map +1 -1
- package/types/methods/render/render-chart.d.ts.map +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/chart",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git@github.com:EOX-A/EOxElements.git"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"vite": "^
|
|
10
|
+
"vite": "^8.2.2"
|
|
11
11
|
},
|
|
12
12
|
"engines": {
|
|
13
13
|
"npm": ">=8.0.0",
|
|
14
|
-
"node": ">=
|
|
14
|
+
"node": ">=24.0.0"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"types",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"watch": "vite build --watch"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@eox/elements-utils": "^1.
|
|
41
|
-
"@eox/ui": "^
|
|
40
|
+
"@eox/elements-utils": "^1.2.0",
|
|
41
|
+
"@eox/ui": "^1.1.0",
|
|
42
42
|
"deepmerge-ts": "^7.1.3",
|
|
43
|
-
"lit": "^3.
|
|
44
|
-
"vega": "^6.
|
|
45
|
-
"vega-embed": "^7.
|
|
46
|
-
"vega-lite": "^6.4.
|
|
43
|
+
"lit": "^3.3.3",
|
|
44
|
+
"vega": "^6.4.0",
|
|
45
|
+
"vega-embed": "^7.2.0",
|
|
46
|
+
"vega-lite": "^6.4.3"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/main.js
CHANGED
|
@@ -7,10 +7,10 @@ import { base64EncodeSpec } from "./methods/encode";
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Chart component based on [Vega-Lite](https://vega.github.io/vega-lite/)/[Vega-Embed](https://github.com/vega/vega-embed).
|
|
10
|
-
* Pass a valid Vega spec as `spec` property in order to render a chart.
|
|
10
|
+
* Pass a valid Vega spec as `spec` property or attribute in order to render a chart.
|
|
11
11
|
* Optionally for transfer of chart definitions with both single and double quote as attribute, use the `spec` as base64 encoded string.
|
|
12
12
|
*
|
|
13
|
-
* The `eox-chart` provides some default `spec` settings (merged with the provided `spec` property) and helper functionalities on top of Vega-Lite.
|
|
13
|
+
* The `eox-chart` provides some default `spec` settings (merged with the provided `spec` property/attribute) and helper functionalities on top of Vega-Lite.
|
|
14
14
|
*
|
|
15
15
|
* Default `spec` settings (see the file `src/enums/default-spec.js`):
|
|
16
16
|
* - `width`: "container" (make the chart width responsive to the parent)
|
|
@@ -19,8 +19,8 @@ import { base64EncodeSpec } from "./methods/encode";
|
|
|
19
19
|
* - `resize`: true (autosize layout is re-calculated on every view update)
|
|
20
20
|
* - `padding`: 16 (the padding in pixels to add around the visualization)
|
|
21
21
|
*
|
|
22
|
-
* These default `spec` settings can be overwritten by setting them to a differnt value in the `spec` property passed to `eox-chart`. Also, there are default
|
|
23
|
-
* Vega-Embed options (see the file `src/enums/default-opt.js`), which can also be overwritten in the passed `opt` property.
|
|
22
|
+
* These default `spec` settings can be overwritten by setting them to a differnt value in the `spec` property/attribute passed to `eox-chart`. Also, there are default
|
|
23
|
+
* Vega-Embed options (see the file `src/enums/default-opt.js`), which can also be overwritten in the passed `opt` property/attribute.
|
|
24
24
|
*
|
|
25
25
|
* Helper functionalities:
|
|
26
26
|
*
|
|
@@ -31,9 +31,9 @@ import { base64EncodeSpec } from "./methods/encode";
|
|
|
31
31
|
*/
|
|
32
32
|
export class EOxChart extends LitElement {
|
|
33
33
|
static properties = {
|
|
34
|
-
dataValues: {
|
|
35
|
-
spec: {
|
|
36
|
-
opt: {
|
|
34
|
+
dataValues: { type: String },
|
|
35
|
+
spec: { type: String },
|
|
36
|
+
opt: { type: Object },
|
|
37
37
|
noShadow: { attribute: "no-shadow", type: Boolean },
|
|
38
38
|
unstyled: { type: Boolean },
|
|
39
39
|
};
|
|
@@ -75,6 +75,22 @@ export class EOxChart extends LitElement {
|
|
|
75
75
|
* @type {Boolean}
|
|
76
76
|
*/
|
|
77
77
|
this.unstyled = false;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* ResizeObserver instance to handle auto-resizing
|
|
81
|
+
*
|
|
82
|
+
* @type {ResizeObserver | null}
|
|
83
|
+
* @private
|
|
84
|
+
*/
|
|
85
|
+
this._resizeObserver = null;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Vega view instance
|
|
89
|
+
*
|
|
90
|
+
* @type {any}
|
|
91
|
+
* @private
|
|
92
|
+
*/
|
|
93
|
+
this._vegaView = null;
|
|
78
94
|
}
|
|
79
95
|
|
|
80
96
|
/**
|
|
@@ -120,10 +136,30 @@ export class EOxChart extends LitElement {
|
|
|
120
136
|
}
|
|
121
137
|
}
|
|
122
138
|
|
|
139
|
+
disconnectedCallback() {
|
|
140
|
+
super.disconnectedCallback();
|
|
141
|
+
if (this._resizeObserver) {
|
|
142
|
+
this._resizeObserver.disconnect();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
123
146
|
/**
|
|
124
147
|
* Append custom styling for vega tooltip
|
|
125
148
|
*/
|
|
126
149
|
firstUpdated() {
|
|
150
|
+
if (typeof ResizeObserver !== "undefined" && !this._resizeObserver) {
|
|
151
|
+
this._resizeObserver = new ResizeObserver(() => {
|
|
152
|
+
if (this._vegaView) {
|
|
153
|
+
window.dispatchEvent(new Event("resize"));
|
|
154
|
+
this._vegaView.resize().runAsync();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
this._resizeObserver.observe(this);
|
|
158
|
+
if (this.parentElement) {
|
|
159
|
+
this._resizeObserver.observe(this.parentElement);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
127
163
|
if (!this.unstyled) {
|
|
128
164
|
const style = document.createElement("style");
|
|
129
165
|
style.innerHTML = `
|
|
@@ -34,6 +34,8 @@ const renderChartMethod = (EOxChart, spec, opt, dataValues) => {
|
|
|
34
34
|
// @ts-expect-error using private method defined on EOxChart
|
|
35
35
|
EOxChart._dispatchItemClickEvent({ event, item });
|
|
36
36
|
});
|
|
37
|
+
// @ts-expect-error using private method defined on EOxChart
|
|
38
|
+
EOxChart._vegaView = res.view;
|
|
37
39
|
});
|
|
38
40
|
};
|
|
39
41
|
|
package/types/main.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Chart component based on [Vega-Lite](https://vega.github.io/vega-lite/)/[Vega-Embed](https://github.com/vega/vega-embed).
|
|
3
|
-
* Pass a valid Vega spec as `spec` property in order to render a chart.
|
|
3
|
+
* Pass a valid Vega spec as `spec` property or attribute in order to render a chart.
|
|
4
4
|
* Optionally for transfer of chart definitions with both single and double quote as attribute, use the `spec` as base64 encoded string.
|
|
5
5
|
*
|
|
6
|
-
* The `eox-chart` provides some default `spec` settings (merged with the provided `spec` property) and helper functionalities on top of Vega-Lite.
|
|
6
|
+
* The `eox-chart` provides some default `spec` settings (merged with the provided `spec` property/attribute) and helper functionalities on top of Vega-Lite.
|
|
7
7
|
*
|
|
8
8
|
* Default `spec` settings (see the file `src/enums/default-spec.js`):
|
|
9
9
|
* - `width`: "container" (make the chart width responsive to the parent)
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
* - `resize`: true (autosize layout is re-calculated on every view update)
|
|
13
13
|
* - `padding`: 16 (the padding in pixels to add around the visualization)
|
|
14
14
|
*
|
|
15
|
-
* These default `spec` settings can be overwritten by setting them to a differnt value in the `spec` property passed to `eox-chart`. Also, there are default
|
|
16
|
-
* Vega-Embed options (see the file `src/enums/default-opt.js`), which can also be overwritten in the passed `opt` property.
|
|
15
|
+
* These default `spec` settings can be overwritten by setting them to a differnt value in the `spec` property/attribute passed to `eox-chart`. Also, there are default
|
|
16
|
+
* Vega-Embed options (see the file `src/enums/default-opt.js`), which can also be overwritten in the passed `opt` property/attribute.
|
|
17
17
|
*
|
|
18
18
|
* Helper functionalities:
|
|
19
19
|
*
|
|
@@ -25,13 +25,12 @@
|
|
|
25
25
|
export class EOxChart extends LitElement {
|
|
26
26
|
static properties: {
|
|
27
27
|
dataValues: {
|
|
28
|
-
|
|
28
|
+
type: StringConstructor;
|
|
29
29
|
};
|
|
30
30
|
spec: {
|
|
31
|
-
|
|
31
|
+
type: StringConstructor;
|
|
32
32
|
};
|
|
33
33
|
opt: {
|
|
34
|
-
attribute: boolean;
|
|
35
34
|
type: ObjectConstructor;
|
|
36
35
|
};
|
|
37
36
|
noShadow: {
|
|
@@ -74,6 +73,20 @@ export class EOxChart extends LitElement {
|
|
|
74
73
|
* @type {Boolean}
|
|
75
74
|
*/
|
|
76
75
|
unstyled: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* ResizeObserver instance to handle auto-resizing
|
|
78
|
+
*
|
|
79
|
+
* @type {ResizeObserver | null}
|
|
80
|
+
* @private
|
|
81
|
+
*/
|
|
82
|
+
private _resizeObserver;
|
|
83
|
+
/**
|
|
84
|
+
* Vega view instance
|
|
85
|
+
*
|
|
86
|
+
* @type {any}
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
private _vegaView;
|
|
77
90
|
/**
|
|
78
91
|
* @private
|
|
79
92
|
*/
|
package/types/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH;IACE;;;;;;;;;;;;;;;;;MAME;IAKA;;;;OAIG;IACH,MAFU,OAAO,YAAY,EAAE,iBAAiB,GAAG,MAAM,CAEpC;IAErB;;;;OAIG;IACH,KAFU,OAAO,YAAY,EAAE,YAAY,CAEvB;IAEpB;;;;OAIG;IACH,YAFU;QAAC,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,kCAAkC,EAAE,UAAU,CAAA;KAAC,GAAG,MAAM,CAEzE;IAE3B;;;;OAIG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAErB;;;;;OAKG;IACH,wBAA2B;IAE3B;;;;;OAKG;IACH,kBAAqB;IAGvB;;OAEG;IACH,sCAUC;IAED;;OAEG;IACH,gCAUC;IAED;;;;OAIG;IACH,2BAFW,OAAO,KAAK,EAAE,cAAc,iBAQtC;IASD;;OAEG;IACH,qBA0CC;IASD;;OAEG;IACH,+CAQC;CACF;2BAnNgC,KAAK;iCAKL,kBAAkB;0BADzB,kBAAkB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,yBACtC,eAAO,
|
|
1
|
+
{"version":3,"file":"render-chart.d.ts","sourceRoot":"","sources":["../../../src/methods/render/render-chart.js"],"names":[],"mappings":";AAIA;;;;;;;GAOG;AACH,6CALW,OAAO,YAAY,EAAE,QAAQ,QAC7B,OAAO,YAAY,EAAE,iBAAiB,yBACtC,eAAO,QA8BjB"}
|