@vaadin/charts 24.0.0-alpha5 → 24.0.0-alpha6
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/LICENSE +1105 -248
- package/README.md +1 -1
- package/package.json +6 -6
- package/src/helpers.js +24 -0
- package/src/vaadin-chart-series.d.ts +7 -2
- package/src/vaadin-chart-series.js +7 -2
- package/src/vaadin-chart.d.ts +7 -2
- package/src/vaadin-chart.js +13 -21
- package/theme/vaadin-chart-base-theme.js +7 -2
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overvi
|
|
|
46
46
|
|
|
47
47
|
## License
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
This program is available under Vaadin Commercial License and Service Terms. For license terms, see LICENSE.
|
|
50
50
|
|
|
51
51
|
Vaadin collects usage statistics at development time to improve this product.
|
|
52
52
|
For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/charts",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-alpha6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/component-base": "24.0.0-
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
41
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
39
|
+
"@vaadin/component-base": "24.0.0-alpha6",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha6",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha6",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha6",
|
|
43
43
|
"highcharts": "9.2.2"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"web-types.json",
|
|
53
53
|
"web-types.lit.json"
|
|
54
54
|
],
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "0004ac92b6e5f415b5fa949e0582d1d11e527b1f"
|
|
56
56
|
}
|
package/src/helpers.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function inflateFunctions(config) {
|
|
2
|
+
if (
|
|
3
|
+
// Check if param is a primitive/null/undefined value
|
|
4
|
+
!(config instanceof Object) ||
|
|
5
|
+
// Check if param is a plain object (not an array or HC object)
|
|
6
|
+
config.constructor !== Object
|
|
7
|
+
) {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
Object.entries(config).forEach(([attr, targetProperty]) => {
|
|
11
|
+
if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
|
|
12
|
+
try {
|
|
13
|
+
// eslint-disable-next-line no-eval
|
|
14
|
+
config[attr.substr(4)] = eval(`(${targetProperty})`);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
// eslint-disable-next-line no-eval
|
|
17
|
+
config[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
|
|
18
|
+
}
|
|
19
|
+
delete config[attr];
|
|
20
|
+
} else if (targetProperty instanceof Object) {
|
|
21
|
+
inflateFunctions(targetProperty);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2022 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import type { PointOptionsObject, Series, SeriesOptionsType } from 'highcharts';
|
|
7
12
|
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2022 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import { PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
12
|
import { Chart, deepMerge } from './vaadin-chart.js';
|
package/src/vaadin-chart.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2022 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import type { Axis, Chart as HighchartsChart, ExtremesObject, Options, Point, Series } from 'highcharts';
|
|
7
12
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
package/src/vaadin-chart.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2022 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
import 'highcharts/es-modules/masters/highstock.src.js';
|
|
7
12
|
import 'highcharts/es-modules/masters/modules/accessibility.src.js';
|
|
@@ -27,6 +32,7 @@ import Highcharts from 'highcharts/es-modules/masters/highstock.src.js';
|
|
|
27
32
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
28
33
|
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
29
34
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
35
|
+
import { inflateFunctions } from './helpers.js';
|
|
30
36
|
import { ChartSeries } from './vaadin-chart-series.js';
|
|
31
37
|
|
|
32
38
|
/** @private */
|
|
@@ -272,6 +278,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
272
278
|
static __callHighchartsFunction(functionName, redrawCharts, ...args) {
|
|
273
279
|
const functionToCall = Highcharts[functionName];
|
|
274
280
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
281
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
275
282
|
functionToCall.apply(this.configuration, args);
|
|
276
283
|
if (redrawCharts) {
|
|
277
284
|
Highcharts.charts.forEach((c) => c.redraw());
|
|
@@ -1148,7 +1155,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1148
1155
|
}
|
|
1149
1156
|
|
|
1150
1157
|
const configCopy = deepMerge({}, jsonConfiguration);
|
|
1151
|
-
|
|
1158
|
+
inflateFunctions(configCopy);
|
|
1152
1159
|
this._jsonConfigurationBuffer = this.__makeConfigurationBuffer(this._jsonConfigurationBuffer, configCopy);
|
|
1153
1160
|
|
|
1154
1161
|
beforeNextRender(this, () => {
|
|
@@ -1214,24 +1221,6 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1214
1221
|
delete configuration[entry];
|
|
1215
1222
|
}
|
|
1216
1223
|
|
|
1217
|
-
/** @private */
|
|
1218
|
-
__inflateFunctions(jsonConfiguration) {
|
|
1219
|
-
Object.entries(jsonConfiguration).forEach(([attr, targetProperty]) => {
|
|
1220
|
-
if (attr.startsWith('_fn_') && (typeof targetProperty === 'string' || targetProperty instanceof String)) {
|
|
1221
|
-
try {
|
|
1222
|
-
// eslint-disable-next-line no-eval
|
|
1223
|
-
jsonConfiguration[attr.substr(4)] = eval(`(${targetProperty})`);
|
|
1224
|
-
} catch (e) {
|
|
1225
|
-
// eslint-disable-next-line no-eval
|
|
1226
|
-
jsonConfiguration[attr.substr(4)] = eval(`(function(){${targetProperty}})`);
|
|
1227
|
-
}
|
|
1228
|
-
delete jsonConfiguration[attr];
|
|
1229
|
-
} else if (targetProperty instanceof Object) {
|
|
1230
|
-
this.__inflateFunctions(targetProperty);
|
|
1231
|
-
}
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
|
|
1235
1224
|
/** @private */
|
|
1236
1225
|
__initEventsListeners(configuration) {
|
|
1237
1226
|
this.__initChartEventsListeners(configuration);
|
|
@@ -1684,6 +1673,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1684
1673
|
if (this.configuration) {
|
|
1685
1674
|
const functionToCall = this.configuration[functionName];
|
|
1686
1675
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1676
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1687
1677
|
functionToCall.apply(this.configuration, args);
|
|
1688
1678
|
}
|
|
1689
1679
|
}
|
|
@@ -1695,6 +1685,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1695
1685
|
const series = this.configuration.series[seriesIndex];
|
|
1696
1686
|
const functionToCall = series[functionName];
|
|
1697
1687
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1688
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1698
1689
|
functionToCall.apply(series, args);
|
|
1699
1690
|
}
|
|
1700
1691
|
}
|
|
@@ -1731,6 +1722,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1731
1722
|
const axis = axes[axisIndex];
|
|
1732
1723
|
const functionToCall = axis[functionName];
|
|
1733
1724
|
if (functionToCall && typeof functionToCall === 'function') {
|
|
1725
|
+
args.forEach((arg) => inflateFunctions(arg));
|
|
1734
1726
|
functionToCall.apply(axis, args);
|
|
1735
1727
|
}
|
|
1736
1728
|
}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
4
|
-
*
|
|
3
|
+
* Copyright (c) 2000 - 2022 Vaadin Ltd.
|
|
4
|
+
*
|
|
5
|
+
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
+
* license.
|
|
5
10
|
*/
|
|
6
11
|
|
|
7
12
|
/**
|
package/web-types.json
CHANGED