@vaadin/charts 24.0.0-alpha5 → 24.0.0-alpha7
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 +24 -32
- package/theme/vaadin-chart-base-theme.js +7 -2
- package/web-types.json +1 -446
- package/web-types.lit.json +1 -330
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-alpha7",
|
|
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-alpha7",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-alpha7",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "24.0.0-alpha7",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-alpha7",
|
|
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": "aeb4535336813636736759e0a5de148b26bfc3b6"
|
|
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());
|
|
@@ -542,12 +549,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
542
549
|
deepMerge(options, this.additionalOptions);
|
|
543
550
|
|
|
544
551
|
if (this.type) {
|
|
545
|
-
options.chart
|
|
552
|
+
options.chart ||= {};
|
|
546
553
|
options.chart.type = this.type;
|
|
547
554
|
}
|
|
548
555
|
|
|
549
556
|
if (this.polar) {
|
|
550
|
-
options.chart
|
|
557
|
+
options.chart ||= {};
|
|
551
558
|
options.chart.polar = true;
|
|
552
559
|
}
|
|
553
560
|
|
|
@@ -572,7 +579,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
572
579
|
}
|
|
573
580
|
|
|
574
581
|
if (this.categories) {
|
|
575
|
-
options.xAxis
|
|
582
|
+
options.xAxis ||= {};
|
|
576
583
|
if (Array.isArray(options.xAxis)) {
|
|
577
584
|
// Set categories on first X axis
|
|
578
585
|
options.xAxis[0].categories = this.categories;
|
|
@@ -582,7 +589,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
582
589
|
}
|
|
583
590
|
|
|
584
591
|
if (isFinite(this.categoryMin)) {
|
|
585
|
-
options.xAxis
|
|
592
|
+
options.xAxis ||= {};
|
|
586
593
|
if (Array.isArray(options.xAxis)) {
|
|
587
594
|
// Set category-min on first X axis
|
|
588
595
|
options.xAxis[0].min = this.categoryMin;
|
|
@@ -592,7 +599,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
592
599
|
}
|
|
593
600
|
|
|
594
601
|
if (isFinite(this.categoryMax)) {
|
|
595
|
-
options.xAxis
|
|
602
|
+
options.xAxis ||= {};
|
|
596
603
|
if (Array.isArray(options.xAxis)) {
|
|
597
604
|
// Set category-max on first x axis
|
|
598
605
|
options.xAxis[0].max = this.categoryMax;
|
|
@@ -608,12 +615,12 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
608
615
|
}
|
|
609
616
|
|
|
610
617
|
if (this.emptyText) {
|
|
611
|
-
options.lang
|
|
618
|
+
options.lang ||= {};
|
|
612
619
|
options.lang.noData = this.emptyText;
|
|
613
620
|
}
|
|
614
621
|
|
|
615
622
|
if (this.categoryPosition) {
|
|
616
|
-
options.chart
|
|
623
|
+
options.chart ||= {};
|
|
617
624
|
|
|
618
625
|
options.chart.inverted = this.__shouldInvert();
|
|
619
626
|
|
|
@@ -627,13 +634,13 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
627
634
|
}
|
|
628
635
|
|
|
629
636
|
if (this.stacking) {
|
|
630
|
-
options.plotOptions
|
|
631
|
-
options.plotOptions.series
|
|
637
|
+
options.plotOptions ||= {};
|
|
638
|
+
options.plotOptions.series ||= {};
|
|
632
639
|
options.plotOptions.series.stacking = this.stacking;
|
|
633
640
|
}
|
|
634
641
|
|
|
635
642
|
if (this.chart3d) {
|
|
636
|
-
options.chart
|
|
643
|
+
options.chart ||= {};
|
|
637
644
|
|
|
638
645
|
options.chart.options3d = { ...this._baseChart3d, ...options.chart.options3d };
|
|
639
646
|
}
|
|
@@ -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);
|
|
@@ -1383,7 +1372,7 @@ class Chart extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
1383
1372
|
|
|
1384
1373
|
path = path.split('.');
|
|
1385
1374
|
return path.reduce((obj, key) => {
|
|
1386
|
-
obj[key]
|
|
1375
|
+
obj[key] ||= {};
|
|
1387
1376
|
return obj[key];
|
|
1388
1377
|
}, object);
|
|
1389
1378
|
}
|
|
@@ -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
|
/**
|